Search code examples
phpmodel-view-controllerlaravellaravel-3

Laravel - How to NOT use a layout


I'm using laravel with controllers layout. But there are some parts of my app where I don't want to use a layout (for example, when returning data to the payment gateway request, for wich I send XML data). I just want to pass data to my view and render it alone, with no need for a layout.

How can I do that? I've been trying some approaches but none worked for this. I can successfuly change what layout to render, but I can't set to render the view without a layout.

Thanks!

Edit: Let me explain it better

My default layout is set in Base_Controller. Then all my controllers extends it but in one of them I need no layout, as I told above. Maybe I need to unset the default layout or something like that, I'm not sure.


Solution

  • You can simply return something from your controller action to bypass the layout.

    function get_xml($id) {
        $user = User::find($id);
        return View::make('user.xml', $user);
    }