Laravel 5.0 怎样在构造函数里保存数据在所有action里调用

大家好,新手,想问大家一个问题.
Laravel 5.0 怎样在构造函数里保存数据在所有action里调用
意思就是说,
public function __construct()
{
$this->with(array('hao123'=>'hao1234569786sdfsdfsdsd'));
}

然后后我想在 视图.blade.php 页面显示 hao123 值

就像 thinkphp $this->assign('hao123','dfsdfsfsf');
这样的
已邀请:

Mr_Jing

赞同来自: dogwin

把数据共享给所有视图
view()->share('data', [1, 2, 3]);

zhuo123

赞同来自:

谢谢你的回复,

要回复问题请先登录注册