Answer the question
In order to leave comments, you need to log in
How to protect against different URL requests in Laravel?
Hello. I'm learning how to build a website in Laravel.
I'm interested in this question:
For example, I made the site the ability to create and delete groups.
There is a route:
Route::get('/group/delete/{id}', 'App\Http\Controllers\[email protected]')->name('group-delete');
Answer the question
In order to leave comments, you need to log in
Firstly, for deleting by the GET method, a special is waiting for you. cauldron in hell.
Secondly, read the Laravel documentation about middleware and policies.
Third, learn the basics of HTTP so you know how to
For example, so that the group ID is not visible in the link, and the ID itself is sent in a different way, not through the URL, and so that requests like www.site.ru/group/delete/2 do not work.
We have already written about deleting and controlling rights, I will add about "hiding" id in urls - there is such a package https://github.com/cybercog/laravel-optimus for this purpose, but in general it is cosmetic
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question