PART 7 - ADDING EDIT AND DELETE PRODUCT OPTION (cont...)

Published: 28 March 2023
on channel: Leo Paliuanan
145
3

Topic: LARAVEL PROJECT (E-SHOP) CAPSTONE PROJECT

PART 7 - ADDING EDIT AND DELETE PRODUCT OPTION (cont...)



we have finished adding the edit and it is now working,
we will now start working with the delete button


lets start
1 - go back to the blade and let's setup our delete button

for the delete we will make use of form with confirmation to delete
add the following code:

form onSubmit="return confirm('Do you really want to proceed with the delete?')" action="{{route('seller.products.destroy',$prod- id)}}" method="post"

@csrf
@method('DELETE')

a href="{{route('seller.products.edit',$prod- id)}}" class="btn btn-sm btn-primary" Edit /a

input type="submit" value="Delete" class="btn btn-danger"
/form








2 go back to the controller and add the ff code:


$delete_prod = products::find($id);

$delete_prod- delete();

return redirect('/seller/products');


=========== we are done with the delete lets add a flashed message after delete


Watch video PART 7 - ADDING EDIT AND DELETE PRODUCT OPTION (cont...) online without registration, duration hours minute second in high quality. This video was added by user Leo Paliuanan 28 March 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 145 once and liked it 3 people.