Blame view

app/Http/Middleware/IsAdmin.php 392 Bytes
31e0a8793   Fedor   task-132687 додел...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  <?php
  
  namespace App\Http\Middleware;
  
  use App\Providers\RouteServiceProvider;
  use Closure;
  use Illuminate\Http\Request;
  use Illuminate\Support\Facades\Auth;
  
  class IsAdmin
  {
      public function handle(Request $request, Closure $next)
      {
          if (Auth::user()->is_admin === 1) {
              return redirect(RouteServiceProvider::HOME);
          }
          return $next($request);
      }
  }