-
app/Http/Livewire/Admin/Users/Approval.php
Open in GitHubuse App\Models\User; use Livewire\Component; class Approval extends Component { public User $user; public function render() { return view('livewire.admin.users.approval'); } public function approve(): Void { $this->user->update([ 'approved' => 1, ]); } }
-
resources/views/livewire/admin/users/approval.blade.php
Open in GitHub<div> @if ($user->approved != 1) <button wire:click="approve" class="w-full lg:w-auto rounded shadow-md py-1 px-2 bg-green-700 text-white hover:bg-green-500 text-xs"> Approve </button> @endif </div>
-
resources/views/admin/users/index.blade.php
Open in GitHub// <td class="flex flex-col lg:flex-row px-4 py-2 lg:justify-end space-y-1 lg:space-y-0 lg:space-x-1"> @livewire('admin.users.approval', ['user' => $user]) <div> <a href="{{ route('admin.users.edit', $user) }}"> <button class="w-full lg:w-auto rounded shadow-md py-1 px-2 bg-green-700 text-white hover:bg-green-500 text-xs"> <i class="fas fa-pencil-alt"></i> </button> </a> </div> <div> <form action="{{ route('admin.users.destroy', $user) }}" method="POST"> @csrf @method('DELETE') <button class="w-full lg:w-auto rounded shadow-md py-1 px-2 bg-gray-400 text-white hover:bg-gray-300 text-xs"> <i class="fas fa-trash"></i> </button> </form> </div> </td> //