santino
6 months ago
1197
3
Feedback

slug on a resource method HELP!! how to do it... :(

Posted 6 months ago by santino

am having a hard issue... I create a resource... buy no idea how to set up a service slug check please

Route::resource('/user/{user}/services', 'ServiceController' , [
    'names' => [
        'index' => 'services',
        'create' => 'newService',
        'store' => 'storeService',
        'edit' => 'editService',
        'update' => 'updateService'
    ]
])

after doing this way I got to change the code to this new one... but I like the first one but don't have any idea how to do it right

check the code I am using...

Route::get('/user/{user:name}/services', '[email protected]')->name('services');
Route::get('/user/{user:name}/services/create', '[email protected]')->name('newService');
Route::post('/user/{user:name}/services', '[email protected]')->name('storeService');
Route::get('/user/{user:name}/services/{service:slug}/edit', '[email protected]')->name('editService');
Route::post('/user/{user:name}/services/{service:slug}', '[email protected]')->name('updateService');

first call the user name... then call the service by it slug, I want to do the same but in the resource method... som idea how to do it?... thanks

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