Files
animethemes-server/app/Http/Api/Schema/Auth/RoleSchema.php
T
ManiandGitHub 5100f13dd8 feat: Added permission for revalidating pages (#654)
* Added permissions as allowed include path.
* Added tracks and playlists as allowed include paths to videos
2024-04-16 17:52:53 +02:00

69 lines
1.7 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\RoleGuardNameField;
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\RoleResource;
use App\Models\Auth\Role;
/**
* Class RoleSchema.
*/
class RoleSchema extends EloquentSchema
{
/**
* Get the type of the resource.
*
* @return string
*/
public function type(): string
{
return RoleResource::$wrap;
}
/**
* Get the allowed includes.
*
* @return AllowedInclude[]
*/
public function allowedIncludes(): array
{
return [
new AllowedInclude(new PermissionSchema(), Role::RELATION_PERMISSIONS),
];
}
/**
* Get the direct fields of the resource.
*
* @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 RoleGuardNameField($this),
new RoleDefaultField($this),
new RoleColorField($this),
new RolePriorityField($this),
];
}
}