mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-28 01:34:43 +02:00
* feat(api): adding roles and permissions relations to my schema * style: fix StyleCI findings
41 lines
898 B
PHP
41 lines
898 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Api\Field\Auth\User;
|
|
|
|
use App\Contracts\Http\Api\Field\SelectableField;
|
|
use App\Http\Api\Field\Field;
|
|
use App\Http\Api\Query\Query;
|
|
use App\Http\Api\Schema\Schema;
|
|
use App\Models\Auth\User;
|
|
|
|
/**
|
|
* Class UserIdField.
|
|
*/
|
|
class UserIdField extends Field implements SelectableField
|
|
{
|
|
/**
|
|
* Create a new field instance.
|
|
*
|
|
* @param Schema $schema
|
|
*/
|
|
public function __construct(Schema $schema)
|
|
{
|
|
parent::__construct($schema, User::ATTRIBUTE_ID);
|
|
}
|
|
|
|
/**
|
|
* Determine if the field should be included in the select clause of our query.
|
|
*
|
|
* @param Query $query
|
|
* @param Schema $schema
|
|
* @return bool
|
|
*/
|
|
public function shouldSelect(Query $query, Schema $schema): bool
|
|
{
|
|
// Needed to match user relation for playlist endpoints
|
|
return true;
|
|
}
|
|
}
|