Skip to content

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

Open
@n00bman

Description

@n00bman

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @n00bman

        Issue actions

          Need to fix routes for Route::resource for Laravel 8 · Issue #76 · coreui/coreui-free-laravel-admin-template