36 lines
508 B
PHP
36 lines
508 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Lucent\Account;
|
||
|
|
|
||
|
|
use Lucent\Primitive\Collection;
|
||
|
|
|
||
|
|
readonly class AccountService
|
||
|
|
{
|
||
|
|
|
||
|
|
public function __construct(
|
||
|
|
private UserRepo $userRepo,
|
||
|
|
)
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return Collection<User>
|
||
|
|
*/
|
||
|
|
public function all(): Collection
|
||
|
|
{
|
||
|
|
return $this->userRepo->all();
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return Collection<UserProfile>
|
||
|
|
*/
|
||
|
|
public function allProfiles(): Collection
|
||
|
|
{
|
||
|
|
return $this->all()->map(fn($user) => $user->safe());
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|