|
@@ -4,33 +4,17 @@
|
|
|
|
|
|
|
|
use App\Http\Requests\PermissionRequest;
|
|
use App\Http\Requests\PermissionRequest;
|
|
|
|
|
|
|
|
-readonly class PermissionDTO
|
|
|
|
|
|
|
+readonly class PermissionDTO extends BaseDTO
|
|
|
{
|
|
{
|
|
|
public function __construct(
|
|
public function __construct(
|
|
|
public string $scope,
|
|
public string $scope,
|
|
|
public string $description,
|
|
public string $description,
|
|
|
public string $bits,
|
|
public string $bits,
|
|
|
public ?string $parent_id,
|
|
public ?string $parent_id,
|
|
|
- ) {
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ) {}
|
|
|
|
|
|
|
|
public static function fromRequest(PermissionRequest $request): self
|
|
public static function fromRequest(PermissionRequest $request): self
|
|
|
{
|
|
{
|
|
|
return new self(...$request->validated());
|
|
return new self(...$request->validated());
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- public function toArray(): array
|
|
|
|
|
- {
|
|
|
|
|
- return get_object_vars($this);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public static function fromArray(array $data): self
|
|
|
|
|
- {
|
|
|
|
|
- return new self(
|
|
|
|
|
- scope: $data['scope'],
|
|
|
|
|
- description: $data['description'],
|
|
|
|
|
- bits: $data['bits'],
|
|
|
|
|
- parent_id: isset($data['parent_id']) ? $data['parent_id'] : null,
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|