26 lines
531 B
PHP
26 lines
531 B
PHP
<?php
|
|
|
|
namespace App\Domains\Admin\Repositories;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
|
|
class AdminUserRepository
|
|
{
|
|
public function findById(int $id): User
|
|
{
|
|
return User::findOrFail($id);
|
|
}
|
|
|
|
public function getListForTenant(string $tenantSlug): Collection
|
|
{
|
|
$query = User::query();
|
|
|
|
if ($tenantSlug !== 'lv') {
|
|
$query->where('local_group', $tenantSlug);
|
|
}
|
|
|
|
return $query->orderBy('lastname')->orderBy('firstname')->get();
|
|
}
|
|
}
|