I have some code like this:
Route::group(['prefix'=>'dashboard'],function(){
Route::get('addnew',function(){
$user = DB::table('users')->where('username','=',session('username'))->first();
$data = array('level' => $user->level, 'name' => $user->name,'email' => $user->email);
return view('layout.addnew')->with($data);
});
Route::get('load',function(){
$user = DB::table('users')->where('username','=',session('username'))->first();
$data = array('level' => $user->level, 'name' => $user->name,'email' => $user->email);
return view('layout.load')->with($data);
});
});
But it don't work when i use public variable like this:
Route::group(['prefix'=>'dashboard'],function(){
$user = DB::table('users')->where('username','=',session('username'))->first();
$data = array('level' => $user->level, 'name' => $user->name,'email' => $user->email);
Route::get('addnew',function(){
return view('layout.addnew')->with($data);
});
Route::get('load',function(){
return view('layout.load')->with($data);
});
});
Help me please!
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1XEdlMB
via IFTTT
Aucun commentaire:
Enregistrer un commentaire