mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-28 17:54:42 +02:00
58 lines
1.2 KiB
PHP
58 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Api\Schema\Auth;
|
|
|
|
use App\Http\Api\Field\Auth\User\UserIdField;
|
|
use App\Http\Api\Field\Auth\User\UserNameField;
|
|
use App\Http\Api\Field\Field;
|
|
use App\Http\Api\Include\AllowedInclude;
|
|
use App\Http\Api\Schema\EloquentSchema;
|
|
use App\Http\Api\Schema\List\PlaylistSchema;
|
|
use App\Http\Resources\Auth\Resource\UserResource;
|
|
use App\Models\Auth\User;
|
|
|
|
/**
|
|
* Class UserSchema.
|
|
*/
|
|
class UserSchema extends EloquentSchema
|
|
{
|
|
/**
|
|
* Get the type of the resource.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function type(): string
|
|
{
|
|
return UserResource::$wrap;
|
|
}
|
|
|
|
/**
|
|
* Get the allowed includes.
|
|
*
|
|
* @return AllowedInclude[]
|
|
*/
|
|
public function allowedIncludes(): array
|
|
{
|
|
return [
|
|
new AllowedInclude(new PlaylistSchema(), User::RELATION_PLAYLISTS),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the direct fields of the resource.
|
|
*
|
|
* @return Field[]
|
|
*
|
|
* @noinspection PhpMissingParentCallCommonInspection
|
|
*/
|
|
public function fields(): array
|
|
{
|
|
return [
|
|
new UserIdField($this),
|
|
new UserNameField($this),
|
|
];
|
|
}
|
|
}
|