0

There i Have An Error In Laravel 6 Routes in This Code:

Route::group(['prefix' => 'list', 'as' => 'list.'], function() 
{
     Route::resource('/', 'StaffsController'); // List
});

In Route List Give Me An Empty Parameter That I Can't Pass It Using :


{{ route('admin.users.staffs.list.edit', ['id' => $person->id]) }}

Route List


 admin/users/staffs/list/{}/edit                   | admin.users.staffs.list.edit

Thank You

Arpit Jain
  • 1,217
  • 8
  • 27
Elfeqy
  • 61
  • 8
  • You can use {{ route('admin.users.staffs.list.edit', $person->id) }} – Kashif Saleem Feb 03 '20 at 13:51
  • Yes It Works In Blade, But After Submitting It Gives Me A 404 | Not Found – Elfeqy Feb 03 '20 at 13:59
  • Did you try manually naming the parameter as specified here: https://laravel.com/docs/master/controllers#restful-naming-resource-route-parameters ? – Raed Yakoubi Feb 03 '20 at 14:10
  • Please can you show the code for your `StaffsController` (or at least the `edit` method including the declaration). – Rwd Feb 03 '20 at 14:27
  • `public function edit($id) { $admin = Admin::findOrFail($id); return view('admin::users.staffs.list.edit', compact('admin')); }` – Elfeqy Feb 03 '20 at 15:09

2 Answers2

1

try this

{{ route('admin.users.staffs.list.edit', $person->id) }}

if not working check route name

0
Route::group([
    'as'     => 'admin.'
], function()
{
    Route::group([
        'as'     => 'users.'
    ], function()
    {
        Route::group([
            'as'     => 'staff.'
        ], function()
        {
           Route::resource('list', 'StaffsController'); // List
        });
    });
});

There is no need for grouping resource route.

Btw you can always call this command php artisan route:list to see what's going on inside of the route.

Vipertecpro
  • 3,056
  • 2
  • 24
  • 43