Blame view

app/Http/Middleware/IsUserWorker.php 398 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 IsUserWorker
  {
      public function handle(Request $request, Closure $next)
      {
          if (Auth::user()->is_worker !== 1) {
              return redirect(RouteServiceProvider::HOME);
          }
          return $next($request);
      }
  }