Level 50
You need to take another look at this: https://laravel.com/docs/8.x/controllers#actions-handled-by-resource-controller
The URL is Restful i.e. we do not need product/update/1 it should be product/1 with method PUT/PATCH and it will trigger the update function. Similarly, product/1 with DELETE will trigger destroy.
$('#mainCatAddEditForm').ajaxSubmit({
url: "{{url('maincat')}}/"+id;
type: 'POST',
data: {
"name": name,
"description": description,
"_token": "{{ csrf_token() }}",
"_method": "PUT"
}
})
1 like