Reputation: 55
Currently my URL for my posts is like domainName\posts\id
.
How do I change this to domainName\id
?
In my web.php
I'm using resource
.
Route::resource('posts', 'PostController');
Upvotes: 1
Views: 96
Reputation: 1647
You can do it by using custom URLS for your post and get requests like this
Route::post('/{any}', 'PostController@postAnything');
Route::get('/{any}', 'PostController@getAnything');
Although this will not be a good practice because these are wild cards and will not let pass any of your requests below them.
Upvotes: 3