Laravel define default layout from controller in good way

前端 未结 3 1420
予麋鹿
予麋鹿 2021-01-05 15:52

I googled two hours, but not found answer. Maybe you can help.

When I define in MyController:

class MyController extends Base_Cont         


        
3条回答
  •  一生所求
    2021-01-05 16:36

    It should be

    public $layout = 'layouts.default';
    

    Here's the link Templating - The Basics

    Now you can return your layout like this

    $view = View::make('entries.index')->with('entries', $entries);
    $this->layout->content = $view->render();
    

提交回复
热议问题