I'm using Laravel 5.1. And I have a problem about variable in my Layout View.
In my Layout view, I use a variable to show an active login user like this one on my DashboardController
:
...
class DashboardController extends Controller {
public function index(Request $request) {
//
$title = "Dashboard";
$userActive = $request->user();
return view('dashboard.index', compact('title', 'userActive'));
}
...
The $userActive
is to show who is login. My problem is i need to write this (the $userActive
) code like above if I use another function, or another Contoller.
How to make it simple by write it only once?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire