IsUserWorker.php
398 Bytes
<?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);
}
}