public function __construct()
{
$this->middleware(function ($request, $next) {
// Get a user instance for the current user
$user = user();
// Share variables with controllers
$this->currentUser = $user;
$this->signedIn = auth()->check();
// Share variables with views
view()->share('signedIn', $this->signedIn);
view()->share('currentUser', $user);
return $next($request);
});
}
/** * PageController constructor. * @param PageRepo $pageRepo * @param BookRepo $bookRepo * @param ChapterRepo $chapterRepo */ public function __construct(PageRepo $pageRepo, BookRepo $bookRepo, ChapterRepo $chapterRepo) { $this->pageRepo = $pageRepo; $this->bookRepo = $bookRepo; $this->chapterRepo = $chapterRepo; parent::__construct(); }