guidsen
guidsen

Reputation: 2393

Laravel 5 Cached Routes not updating

I've cached my Laravel 5 routes by doing php artisan route:cache. This went succesfull for quite a while and when I changed a route is could cache them again and it would all work like it should.

The problem is that I've moved some routes to another route group and it seems that they won't be cached for some reason.

I've tried to cache them again but it didn't work. I've also tried php artisan cache:clear but still not working.

Routes.php changes:

Route::group(['prefix' => 'api', 'middleware' => 'auth'], function () {
   Route::get('invites', 'InvitationController@get');
   Route::get('invites/check', 'InvitationController@check');
});

Changed to:

Route::group(['prefix' => 'api'], function () {
   Route::post('auth', 'Auth\AuthController@authenticate');
   Route::get('invites', 'InvitationController@get');
   Route::get('invites/check', 'InvitationController@check');
});

As you can see I've moved those invitation routes to the Route group without the Authenticate Middleware. When I cached the routes again, it still does execute the Auth Middleware even when they are moved out of the group..

Upvotes: 14

Views: 20460

Answers (3)

irfanyy
irfanyy

Reputation: 99

If you don't want to optimize again with every change. You can try this;

CACHE_DRIVER=file to change => CACHE_DRIVER=array

After, you should clear to folder "bootstrap/cache"

I hope it works.

Upvotes: 1

MITHUN RAJ
MITHUN RAJ

Reputation: 21

Try:

php artisan optimize

This will clear all the route cache as well as the file cache.

Upvotes: 2

Goopil
Goopil

Reputation: 311

The right syntaxe to remove cached route in laravel 5.* is

php artisan route:clear

Regards

Upvotes: 31

Related Questions