Reputation: 6750
Is there a way to disable layout for certain controller method?
Im using something like $this->layout = null
,yet it still render the layout
The view im rendering obviously have a layout associate with it, i just wonder is it possbile to disable the layout from within controller method, without need to modify the blade file itself
Here is the controller:
class PurchaserController extends \BaseController
{
public function index()
{
$this->layout = null;
return View::make('purchasers.index');
}
}
The view:
@extends('layouts.master')
@section('content')
Content
@stop
Im using Laravel 4
Upvotes: 0
Views: 2276
Reputation: 60058
Just remove
@extends('layouts.master')
from your view. That will prevent the view from loading.
Also - if you are using the @extends - then you dont actually need $this->layout()
in your controller at all
Edit:
" i just wonder is it possbile to disable the layout from within controller method, without need to modify the blade file itself"
The idea is you do it either entirely from the controller, or entirely from the blade file. Not both together.
Upvotes: 1