method() == 'OPTIONS' ? response('') : $handler($request); $response->withHeaders([ 'Access-Control-Allow-Origin' => '*', 'Access-Control-Allow-Credentials' => 'true', 'Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With,Origin', 'Access-Control-Allow-Methods' => 'GET,POST,PUT,DELETE,OPTIONS,PATCH', ]); return $response; } }