1// add a middleware (php artisan make:middleware Cors)
2// add in your kernel (\App\Http\Middleware\Cors::class,)
3public function handle(Request $request, Closure $next)
4{
5 return $next($request)->header('Access-Control-Allow-Origin', '*')
6 ->header('Access-Control-Allow-Methods','GET, POST, PUT, PATCH, DELETE, OPTIONS')
7 ->header('Access-Control-Allow-Headers','Origin, X-Requested-With, Content-Type, Accept, Authorization');
8}