How do I pass a variable to the layout using Laravel' Blade templating?

后端 未结 11 2175
猫巷女王i
猫巷女王i 2021-01-30 03:30

In Laravel 4, my controller uses a Blade layout:

class PagesController extends BaseController {
    protected $layout = \         


        
11条回答
  •  渐次进展
    2021-01-30 04:22

    $data['title'] = $this->layout->title = 'The Home Page';
    $this->layout->content = View::make('home', $data);
    

    I've done this so far because I needed in both the view and master file. It seems if you don't use $this->layout->title it won't be available in the master layout. Improvements welcome!

提交回复
热议问题