In L4, you can define the $layout template in the controller and then use it in the request
<code>$this->layout->content = View::make(sth view)</code>
It doesn’t work in L5.3 today, do you have any solutions
In L4, you can define the $layout template in the controller and then use it in the request
<code>$this->layout->content = View::make(sth view)</code>
It doesn’t work in L5.3 today, do you have any solutions
I’m really sorry, I’ve never used L4
Controller in Laravel 5 is a blank class without any variables in it, including
layout
Many upgrades and changes have been made in 5 and require re-learning.
If you are using
Laravel 5, try using it in the following way, which is to turn fields into methods
<code>// 在 controller 中设置原本4中设置的 $layout 视图值 public $layout_path = 'view_path'; // 提供一个方法获取 layout 视图 public function layout() { return view($this->layout_path); } // 使用( 将原本的$this->layout 改成 $this->layout() ) $this->layout()->content = View::make(sth view);</code>