lundi 20 juillet 2020

Expansion of laravel Route::resource laravel 7

For middleware reasons I decided to expand my current Route::resource routes on Laravel 7. However, I do want to make sure routes are expanded properly and identically so there are no issues in future. I came up with this list of routes :

Route::get('checklists', 'ChecklistController@index')->name('checklists.index');

Route::get('checklists/create', 'ChecklistController@create')->name('checklists.create');

Route::post('checklists', 'ChecklistController@store')->name('checklists.store');

Route::get('checklists/{checklist}', 'ChecklistController@show')->name('checklists.show');

Route::get('checklists/{checklist}/edit', 'ChecklistController@edit')->name('checklists.edit');

Route::match(['PUT', 'PATCH'], 'checklists/{checklist}', ['as' => 'checklists.update', 'uses' => 'ChecklistController@update']);

Route::delete('checklists/{checklist}', 'ChecklistController@destroy')->name('checklists.destroy');

instead of:

Route::resource('checklists', 'ChecklistController');

It may be a bit weird question, but could anyone confirm if this expanded version would generate an exact replacement for Route::resource? And if not, what else do I need to do to make sure it works exactly same? I could not find that information.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire