Skip to content

Commit c2ef7cc

Browse files
author
ahmadhuss
committed
feat: Added delete button form view
1 parent 81a66e5 commit c2ef7cc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

resources/views/categories/index.blade.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@
2222
<td>{{ $category->name }}</td>
2323
<td>
2424
<a class="btn btn-primary" href="{{ route('categories.edit', $category->id) }}">Edit</a>
25-
<a class="btn btn-danger" href="{{ route('categories.destroy', $category->id) }}">Delete</a>
25+
{{-- Delete always will be a Form with method POST --}}
26+
<form method="POST" action="{{ route('categories.destroy', $category->id) }}" class="d-inline">
27+
<input type="submit" class="btn btn-danger" value="Delete" onclick="confirm('Are you sure about this?')"/>
28+
@method('DELETE')
29+
@csrf
30+
</form>
2631
</td>
2732
</tr>
2833
@endforeach

0 commit comments

Comments
 (0)