BookStack\Http\Controllers\Controller::__construct PHP Method

__construct() public method

Controller constructor.
public __construct ( )
    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);
        });
    }

Usage Example

Esempio n. 1
0
 /**
  * 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();
 }
All Usage Examples Of BookStack\Http\Controllers\Controller::__construct