I have Laravel 5.4 Base Controller which should share along children Controllers some common data depending on current Authenticated user.
I was Trying to get it like
public function __construct(ValidationFactory $validation)
{
$this->middleware(array('auth', 'lockscreen'));
var_dump(\Auth::user());
die;
}
this do not works.
private $userId;
public function __construct()
{
$this->middleware(function ($request, $next) {
$this->userId = Auth::user()->id;
return $next($request);
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With