* @author James Brooks */ class Acceptable { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|null $type * * @return mixed */ public function handle(Request $request, Closure $next, $type = null) { if (!$request->accepts($type ?: 'application/json')) { throw new NotAcceptableHttpException(); } return $next($request); } }