mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Api\Schema\Auth;
|
|
|
|
use App\Http\Api\Field\Auth\Role\RoleColorField;
|
|
use App\Http\Api\Field\Auth\Role\RoleDefaultField;
|
|
use App\Http\Api\Field\Auth\Role\RoleNameField;
|
|
use App\Http\Api\Field\Auth\Role\RolePriorityField;
|
|
use App\Http\Api\Field\Base\CreatedAtField;
|
|
use App\Http\Api\Field\Base\IdField;
|
|
use App\Http\Api\Field\Base\UpdatedAtField;
|
|
use App\Http\Api\Field\Field;
|
|
use App\Http\Api\Include\AllowedInclude;
|
|
use App\Http\Api\Schema\EloquentSchema;
|
|
use App\Http\Resources\Auth\Resource\RoleJsonResource;
|
|
use App\Models\Auth\Role;
|
|
|
|
class RoleSchema extends EloquentSchema
|
|
{
|
|
public function type(): string
|
|
{
|
|
return RoleJsonResource::$wrap;
|
|
}
|
|
|
|
/**
|
|
* @return AllowedInclude[]
|
|
*/
|
|
public function allowedIncludes(): array
|
|
{
|
|
return $this->withIntermediatePaths([
|
|
new AllowedInclude(new PermissionSchema(), Role::RELATION_PERMISSIONS),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* @return Field[]
|
|
*
|
|
* @noinspection PhpMissingParentCallCommonInspection
|
|
*/
|
|
public function fields(): array
|
|
{
|
|
return [
|
|
new CreatedAtField($this),
|
|
new UpdatedAtField($this),
|
|
new IdField($this, Role::ATTRIBUTE_ID),
|
|
new RoleNameField($this),
|
|
new RoleDefaultField($this),
|
|
new RoleColorField($this),
|
|
new RolePriorityField($this),
|
|
];
|
|
}
|
|
}
|