| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace App\Services;
- use Illuminate\Database\Eloquent\Collection;
- use App\Repositories\PermissionRepositoryInterface;
- use App\DTO\PermissionDTO;
- use App\Models\Permission;
- class PermissionService
- {
- public function __construct(
- protected PermissionRepositoryInterface $permissionRepository,
- ) {
- }
- public function all(): ?Collection
- {
- return $this->permissionRepository->all();
- }
- public function allNoTree(): ?Collection
- {
- return $this->permissionRepository->allNoTree();
- }
- public function find(int $id): ?Permission
- {
- return $this->permissionRepository->find(id: $id);
- }
- public function findByScope(string $scope): ?Permission
- {
- return $this->permissionRepository->findByScope(scope: $scope);
- }
- public function store(PermissionDTO $permissionDTO): Permission
- {
- return $this->permissionRepository->store(permissionDTO: $permissionDTO);
- }
- public function update(PermissionDTO $permissionDTO, int $id): ?Permission
- {
- return $this->permissionRepository->update(permissionDTO: $permissionDTO, id: $id);
- }
- public function delete(int $id): bool
- {
- return $this->permissionRepository->delete(id: $id);
- }
- }
|