Implement roles management;
Add user profile; Improve Ui; Clean code; Minor fix; Typo;
This commit is contained in:
57
resources/views/roles/index.blade.php
Normal file
57
resources/views/roles/index.blade.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<x-app-layout>
|
||||
<div class="card">
|
||||
<div class="card-header">Manage Roles</div>
|
||||
<div class="card-body">
|
||||
@can('create-role')
|
||||
<a href="{{ route('roles.create') }}" class="btn btn-success btn-xs my-2"><i class="bi bi-plus-circle"></i> Add New Role</a>
|
||||
@endcan
|
||||
<table class="table table-striped table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">S#</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col" style="width: 250px;">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($roles as $role)
|
||||
<tr>
|
||||
<th scope="row">{{ $loop->iteration }}</th>
|
||||
<td>{{ $role->name }}</td>
|
||||
<td>
|
||||
<form action="{{ route('roles.destroy', $role->id) }}" method="post">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
|
||||
<a href="{{ route('roles.show', $role->id) }}" class="btn btn-warning btn-xs">Show</a>
|
||||
|
||||
@if ($role->name!='ADMIN')
|
||||
@can('edit-role')
|
||||
<a href="{{ route('roles.edit', $role->id) }}" class="btn btn-primary btn-xs">Edit</a>
|
||||
@endcan
|
||||
|
||||
@can('delete-role')
|
||||
@if ($role->name!=Auth::user()->hasRole($role->name))
|
||||
<button type="submit" class="btn btn-danger btn-xs" onclick="return confirm('Do you want to delete this role?');">Delete</button>
|
||||
@endif
|
||||
@endcan
|
||||
@endif
|
||||
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<td colspan="3">
|
||||
<span class="text-danger">
|
||||
<strong>No Role Found!</strong>
|
||||
</span>
|
||||
</td>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{{ $roles->links() }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
Reference in New Issue
Block a user