first&last

This commit is contained in:
sbb45
2026-03-20 15:47:17 +05:00
commit d6441abdd2
230 changed files with 20367 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace App\Livewire\Users;
use App\Models\User;
use Livewire\Attributes\Layout;
use Livewire\Component;
use Livewire\WithPagination;
#[Layout('layouts.app')]
class UsersIndexPage extends Component
{
use WithPagination;
public string $search = '';
public string $role = '';
public string $status = '';
public function mount(): void
{
abort_unless(auth()->user()->isAdmin() || auth()->user()->isManager(), 403);
}
public function render()
{
$users = User::query()
->with('department')
->when($this->search !== '', function ($query): void {
$query->where(function ($q): void {
$q->where('name', 'like', "%{$this->search}%")
->orWhere('email', 'like', "%{$this->search}%");
});
})
->when($this->role !== '', fn ($q) => $q->where('role', $this->role))
->when($this->status !== '', fn ($q) => $q->where('is_active', $this->status === 'active'))
->latest()
->paginate(15);
return view('livewire.users.users-index-page', [
'users' => $users,
])->title('Пользователи');
}
}