mirror of
https://gitlab.com/izyim/prototypes/ddd-example.git
synced 2026-08-19 20:44:07 +00:00
25 lines
645 B
PHP
25 lines
645 B
PHP
<?php
|
|
|
|
namespace Src\Zone\User\Application\UseCases\Queries;
|
|
|
|
use Src\Zone\User\Domain\Policies\UserPolicy;
|
|
use Src\Zone\User\Domain\Repositories\UserRepositoryInterface;
|
|
use Src\Common\Domain\QueryInterface;
|
|
|
|
class FindAllUsersQuery implements QueryInterface
|
|
{
|
|
private UserRepositoryInterface $repository;
|
|
private UserPolicy $policy;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->repository = app()->make(UserRepositoryInterface::class);
|
|
$this->policy = new UserPolicy();
|
|
}
|
|
|
|
public function handle(): array
|
|
{
|
|
authorize('findAll', $this->policy);
|
|
return $this->repository->findAll();
|
|
}
|
|
} |