API request error with barryvdh/Laravel-cors

Posted 1 year ago by cleopatra

I used Barryvdh Laravel-cors class to create an API endpoint for my app. I followed the following steps for that.

  1. install it using composer require barryvdh/laravel-cors

  2. updated my middleware group Route::group(['prefix' => 'api/v1', 'middleware' =>['api', 'cors'] ], function(){ Route::resource('posts', 'PostsController'); });

  3. updated config/app.php providers array with Barryvdh\Cors\ServiceProvider::class,

but i got the following error. how can i solve this??

(1/1) ReflectionException

Class cors does not exist in Container.php (line 729)

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.