laravel api enable cors
//I always use an easy method. Just add below lines to publicindex.php file.
//You don't have to use a middleware I think.
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');