Support the ongoing development of Laravel.io →
posted 2 years ago
Forms
Last updated by @nnngit 2 years ago.
0

Please share some code. There's very little here to start with. What is the code that you're using, what is happening and what do you expect to happen?

0

i seen in lara docs that there can be same name in route with get post verb for view also this adapts

0

Please share some code.

0
Route::get('view/{id}', 'PostController@show')->name('post');
Route::delete('view/{id}', 'PostController@delete')->name('post');
Route::post('view/{id}', 'PostController@save')->name('post');

does laravel takes same route name with diff verbs internally laravel takes care v can give like above

Last updated 2 years ago.
0

No, you'll need to use unique names for these. This is important when, for example, caching routes:

Route::get('view/{id}', 'PostController@show')->name('post');
Route::delete('view/{id}', 'PostController@delete')->name('post.delete');
Route::post('view/{id}', 'PostController@save')->name('post.create');

However, you can also just name one route and since it references the same url, it doesn't matter:

Route::get('view/{id}', 'PostController@show')->name('post');
Route::delete('view/{id}', 'PostController@delete');
Route::post('view/{id}', 'PostController@save');
0

Sign in to participate in this thread!

Eventy

Your banner here too?

sslaravel nnngit Joined 26 Mar 2022

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.