视图共享,可以写在控制请的构造函数里
public function __construct()
{
$this->leave = new \App\Leave();
$this->recruitment = new \App\Recruitment();
$carousel_datas = \App\Carousel::orderBy ('figure_id','desc')->take(2)->get();
$partner_datas = \App\Partner::orderBy('partner_id','desc')->take(4)->get();
\View::share('carousel_datas',$carousel_datas);
\View::share('partner_datas',$partner_datas);
}
这里的共享不需要指定模板
可以直接在每个模板里面取值 $carousel_datas $partner_datas,