. */ namespace Poniverse\Ponyfm\Http\Middleware; use Closure; use Gate; use Illuminate\Contracts\Auth\Guard; 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); } }