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
Смотрите видео PART 7 - ADDING EDIT AND DELETE PRODUCT OPTION (cont...) онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Leo Paliuanan 28 Март 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 145 раз и оно понравилось 3 людям.