I'm using Laravel 6 and php 7 along with ReactJS. I'm following Build a Basic CRUD App with Laravel and React tutorial to learn how to make a CRUD app. In the tutorial, it says that I need to enable CORS so the API can be accessed from the front-end application. After I install the barryvdh cors by running:
composer require barryvdh/laravel-cors
and add it to my Kernel.php:
protected $middlewareGroups = [
'web' => [
...
\Barryvdh\Cors\HandleCors::class,
],
'api' => [
...
\Barryvdh\Cors\HandleCors::class,
],
];
the class is still undefined in Laravel and I get the error shown here
Here is a screenshot of my code.
Does anyone know how to solve this issue?