user destroy

This commit is contained in:
Александр Бабкин
2022-06-29 13:22:21 +03:00
parent 90de0d96f3
commit 94fdd4809d
3 changed files with 24 additions and 4 deletions

View File

@@ -116,6 +116,7 @@ class UserController extends Controller
*/
public function destroy($id)
{
//
User::findOrFail($id)->delete();
return redirect()->route('users.index');
}
}

View File

@@ -752,9 +752,15 @@ select {
.mt-6 {
margin-top: 1.5rem;
}
.mb-2 {
margin-bottom: 0.5rem;
}
.block {
display: block;
}
.inline-block {
display: inline-block;
}
.flex {
display: flex;
}
@@ -9114,6 +9120,10 @@ readers do not read off random characters that represent icons */
--tw-text-opacity: 1;
color: rgb(31 41 55 / var(--tw-text-opacity));
}
.hover\:text-red-900:hover {
--tw-text-opacity: 1;
color: rgb(127 29 29 / var(--tw-text-opacity));
}
.focus\:z-10:focus {
z-index: 10;
}

View File

@@ -16,7 +16,7 @@
</button>
</a>
<div align="center" class="pt-4">
<div align="center" class="pt-4">
<table class="table table-sm border-b border-gray-200">
<tr class="border border-gray-200">
<th class="p-2 border border-gray-200">
@@ -45,9 +45,18 @@
<a href="{{ route('users.edit',$user->id) }}">
<i class="fa fa-edit text-blue-500 hover:text-blue-700 px-2 text-lg"></i>
</a>
<a href="{{ route('users.destroy',$user->id) }}">
<!-- <a href="{{ route('users.destroy',$user->id) }}">
<i class="fa fa-trash text-red-500 hover:text-red-700 px-2 text-lg"></i>
</a>
</a> -->
@if ($user->id > 1)
<form class="inline-block" action="{{ route('users.destroy', $user->id) }}" method="POST" onsubmit="return confirm('{{ __('Are you sure remove user ').$user->name.'?' }}');">
<input type="hidden" name="_method" value="DELETE">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<button type="submit">
<i class="fa fa-trash text-red-500 hover:text-red-700 px-2 text-lg"></i>
</button>
</form>
@endif
</div>
</td>
</tr>