I have followed https://github.com/barryvdh/laravel-cors to enable CORS on my application.
When I refresh my page (REST endpoint), I get the following message :-
Class cors does not exist
I ran the following command :-
composer require barryvdh/laravel-cors 0.7.x
and have the following line in my composer.json
"barryvdh/laravel-cors": "0.7.x"
Routes.php
Route::group(['middleware' => 'cors'], function($router){
$router->get('names/{id}', 'NameController@showEmpDetail');
$router->resource('names', 'NameController');
});
I am guessing that somewhere I'll need to call the package, like use the package etc..but I am not finding any result to help me out.
Please help.
Thanks
Try to add
'cors' => \Barryvdh\Cors\Middleware\HandleCors::class,
to
/app/Http/Kernel.php $routeMiddleware
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With