mstdmstd
7 months ago

Why doubled name in route name ?

Posted 7 months ago by mstdmstd

Hello, In my laravel 5.7 app in routes/web.php I have definitions :

Route::group(['middleware' => ['auth'], 'prefix' => 'admin', 'as' => 'admin.'], function () {
...
    Route::resource('departments', 'Admin\DepartmentsController', [ 'as' => 'departments', 'except' => [] ] )->middleware('WorkTextString');
    Route::get( 'get-departments-dt-listing', [ 'uses' => 'Admin\[email protected]_departments_dt_listing' ] );

Running command

php artisan route:list

I see : index is defined with name admin.departments.departments.index :

|        | GET|HEAD  | admin/departments                                    | admin.departments.departments.index                   | App\Http\Controllers\Admin\[email protected]                                     | web,auth,WorkTextString |

and this name I have to use calling redirect()->route( method.

Why I have 2 departments. in name and how to remove 1 of it?

Thanks!

Please sign in or create an account to participate in this conversation.