Cors.php 469 B

12345678910111213141516171819202122
  1. <?php
  2. namespace App\Http\Middleware;
  3. use Closure;
  4. class Cors
  5. {
  6. /**
  7. * Handle an incoming request.
  8. *
  9. * @param \Illuminate\Http\Request $request
  10. * @param \Closure $next
  11. * @return mixed
  12. */
  13. public function handle($request, Closure $next)
  14. {
  15. return $next($request)
  16. ->header('Access-Control-Allow-Origin', '*')
  17. ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
  18. }
  19. }