Using resources
Raptoorka opened this issue · 3 comments
You don't need two different routes for creating and deleting favorite ( I saw it also in CART).
You can use resources instead.
If you don't use all of the resources method in your controller just add only/except to you resource route.
https://laravel.com/docs/8.x/controllers#restful-partial-resource-routes
In the Favorite Controller, I used different routes for creating and deleting because I face something wrong when I click the unfavorite link by ajax call so I use different routes.
In CART I used different routes for index and deleting because in resources the destroy method is "POST" but I used "GET" on DELETE method
In the Favorite Controller, I used different routes for creating and deleting because I face something wrong when I click the unfavorite link by ajax call so I use different routes.
In CART I used different routes for index and deleting because in resources the destroy method is "POST" but I used "GET" on DELETE method
I think you should use DELETE method for deleting.
https://laravel.com/docs/8.x/controllers#actions-handled-by-resource-controller
I know that it is secure if I use "POST" method but in my case here nothing important if someone remove items from cart page
But I will change it like your review because you right.