File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
resources/views/livewire/admin Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 9
9
class AdminProductComponent extends Component
10
10
{
11
11
use WithPagination;
12
+ public function deleteProduct ($ id ){
13
+ $ product = Product::find ($ id );
14
+ $ product ->delete ();
15
+ session ()->flash ('message ' , 'Product has been deleted successfully! ' );
16
+ }
12
17
public function render ()
13
18
{
14
19
Original file line number Diff line number Diff line change 23
23
</div >
24
24
</div >
25
25
<div class =" panel-body" >
26
+ @if (Session:: has (' message' ) )
27
+ <div class =" alert alert-success" role =" alert" >{{ Session:: get (' message' ) } } </div >
28
+ @endif
26
29
<table class =" table table-striped" >
27
30
<thead >
28
31
<tr >
50
53
<a href =" {{ route (' admin.editproduct' , [' product_slug' => $product -> slug ]) } }" >
51
54
<i class =" fa fa-edit fa-2x text-info" ></i >
52
55
</a >
56
+ <a href =" #" style =" margin-left : 10px " wire:click.prevent =" deleteProduct({{ $product -> id } } )" >
57
+ <i class =" fa fa-times fa-2x text-danger" ></i >
58
+ </a >
53
59
</td >
54
60
</tr >
55
61
@endforeach
You can’t perform that action at this time.
0 commit comments