I have used resourceful routing for my Project model
Route::model('projects', 'Project');
Route::bind('projects', function($value, $route) {
return App\Project::whereId($value)->first();
});
Route::resource('projects', 'ProjectsController');
This all works fine, and I have access to all the functions. So if I go to
I can see all the projects. If I do something like
I can see project with the id 24.
Now on my projects page, I have a load project button. The idea is that the user enters the id of the project they want to see, and it will take them to the show page of this project. So I added an additional route
Route::get('projects/{projects}', array('as' => 'projects.loadProject', 'uses' => 'ProjectsController@loadProject'));
The problem is that this route gets the same url as a show page. Therefore, if I now go to the show page for project with the id 24, I now get an empty page. So it looks like this route is now overriding the show route.
How can I set it up to load a project based on an id?
Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire