Blame view

app/Http/Middleware/CanInstall.php 522 Bytes
b7c7a5f6   Alexey Boroda   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  <?php
  
  namespace App\Http\Middleware;
  
  use Closure;
  
  class CanInstall
  {
      /**
       * Handle an incoming request.
       *
       * @param  \Illuminate\Http\Request  $request
       * @param  \Closure  $next
       * @return mixed
       */
      public function handle($request, Closure $next)
      {
          // Check if app is installed
          if (env('APP_INSTALLED', false) == false) {
              return $next($request);
          }
  
          // Already installed, redirect to login
          redirect('auth/login')->send();
      }
  }