Guest User

Untitled

a guest
Jan 24th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. <?php namespace App\Providers;
  2.  
  3. use Illuminate\Support\ServiceProvider;
  4.  
  5. /**
  6. * If the incoming request is an OPTIONS request
  7. * we will register a handler for the requested route
  8. */
  9. class CatchAllOptionsRequestsProvider extends ServiceProvider {
  10.  
  11. public function register()
  12. {
  13. $request = app('request');
  14.  
  15. if ($request->isMethod('OPTIONS'))
  16. {
  17. app()->options($request->path(), function() { return response('', 200); });
  18. }
  19. }
  20.  
  21. }
Add Comment
Please, Sign In to add comment