Dr. MAF
Dr. MAF

Reputation: 1985

Laravel route doesn't get to the controller

My project was working just fine till few hours ago. Some routes still working and some stopped. I tried to delete the new modification I made but the problem persists!!!!! For example, this route used to go to index() method at the guest controller and returns a gust view of activities, and still working fine:

Route::get('activities', 'guestController@showguestactivities');

and this line of code used to go to index() method at the activities controller, but for now it returns just whit-blank page:

Route::resource('admin/activities', 'activitiesController');

I tried to return just a string like that:

Route::get('admin/activities', function(){return 'Just string for Activiteis';});

but it returns the white page again. I found that there is a conflict happening with this resource:

Route::resource('admin', 'adminController');

once I remove it, every thing else works. But I need this resource and I can't just delete it.

Any help will be appreciated.

Upvotes: 4

Views: 2648

Answers (2)

lukasgeiter
lukasgeiter

Reputation: 153120

It seems that the order is of importance. If you register admin/activities before admin it should work fine:

Route::resource('admin/activities', 'activitiesController');
Route::resource('admin', 'adminController');

Upvotes: 5

Sajad Karuthedath
Sajad Karuthedath

Reputation: 15837

I think it should be

Route::get('admin/activities', 'activitiesController@index');

instead of

Route::resource('admin/activities', 'activitiesController');

Upvotes: 0

Related Questions