- // Share variables with controllers
- $this->currentUser = $user;
- $this->signedIn = auth()->check();
+ // 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);
+ });
+ }
+
+ /**
+ * Stops the application and shows a permission error if
+ * the application is in demo mode.
+ */
+ protected function preventAccessForDemoUsers()
+ {
+ if (config('app.env') === 'demo') $this->showPermissionError();