. */ namespace App\Http\Middleware; use Closure; use Illuminate\Contracts\Auth\Guard; use Illuminate\Support\Facades\Gate; class Authorize { /** * The Guard implementation. * * @var Guard */ protected $auth; /** * Create a new filter instance. * * @param Guard $auth */ public function __construct(Guard $auth) { $this->auth = $auth; } /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string * @return mixed */ public function handle($request, Closure $next, $ability) { if (Gate::denies($ability)) { abort(403); } return $next($request); } }