e
Showing
1 changed file
with
11 additions
and
5 deletions
| 1 | <?php | 1 | <?php |
| 2 | |||
| 2 | namespace App\Http\Middleware; | 3 | namespace App\Http\Middleware; |
| 3 | 4 | ||
| 4 | use Closure; | 5 | use Closure; |
| 6 | use Illuminate\Contracts\Routing\Middleware; | ||
| 7 | use Illuminate\Session\TokenMismatchException; | ||
| 8 | |||
| 9 | class Cors implements Middleware { | ||
| 5 | 10 | ||
| 6 | class Cors { | ||
| 7 | public function handle($request, Closure $next) | 11 | public function handle($request, Closure $next) |
| 8 | { | 12 | { |
| 9 | return $next($request) | 13 | $response = $next($request); |
| 10 | ->header('Access-Control-Allow-Origin', '*') | 14 | $response->headers->set('Access-Control-Allow-Origin', '*')->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); |
| 11 | ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); | 15 | |
| 16 | return $response; | ||
| 12 | } | 17 | } |
| 13 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 18 | |||
| 19 | } | ... | ... |
-
Please register or sign in to post a comment