Category management
Out of the box you will have an example of category management (for the cases in which you are developing a blog or a shop). To access this example, click the "Examples/Category Management" link in the left sidebar or add /category to the URL. You can add and edit categories here, but you can only delete them if they are not attached to any items.
@if ($category->items->isEmpty() && auth()->user()->can('delete', $category))
<form action="{{ route('category.destroy', $category) }}" method="post" style="display:inline-block;" class ="delete-form">
@csrf
@method('delete')
<button type="button" rel="tooltip" class="btn btn-danger btn-icon btn-sm delete-button" data-original-title="" title="" onclick="demo.showSwal('warning-message-and-confirmation')">
<i class="now-ui-icons ui-1_simple-remove"></i>
</button>
</form>
@endif
The policy which authorizes the user on categories management pages is implemented in App\Policies\CategoryPolicy.php
.