我有一个UserController
,我希望将UserController
功能的数据发送到app.blade.php
。
function sessionUser(){
$data['status'] = Auth::user()->status;
$data['id'] = Auth::id();
$data['values]=DB::table('user_permission)->get();
return view('app.blade', compact('data'));
}
和app.blade.php
dd($data);
答案 0 :(得分:0)
试一试:
function sessionUser(){
$data['status'] = Auth::user()->status;
$data['id'] = Auth::id();
$data['values']=DB::table('user_permission')->get();
return view('app')->with($data);
}
或者
function sessionUser(){
$status = Auth::user()->status;
$id = Auth::id();
$values = DB::table('user_permission')->get();
return view('app', compact('status','id','values'));
}
然后echo dd($status);