Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to fix routes for Route::resource for Laravel 8 #76

Open
n00bman opened this issue Sep 18, 2021 · 0 comments
Open

Need to fix routes for Route::resource for Laravel 8 #76

n00bman opened this issue Sep 18, 2021 · 0 comments

Comments

@n00bman
Copy link

n00bman commented Sep 18, 2021

If you install this template then you can get this errors

Unknown named parameter $note
...
Unknown named parameter $user

From official documentation:

By default, Route::resource will create the route parameters for your resource routes based on the "singularized" version of the resource name.

So for routes that generates using resource there should be methods in controllers with appropriate param names. But in current controllers this param names like $id and not like singularized version. So we should change routes or controller param names. the easy way to fix route files like this:

Route::resource('notes', 'NotesController')->parameters([ 'notes' => 'id']);
...
Route::resource('users', 'UsersController')->except( ['create', 'store'] )->parameters([ 'users' => 'id']);

and etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant