mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
30 lines
770 B
PHP
30 lines
770 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Actions\GraphQL;
|
|
|
|
use App\Concerns\Actions\GraphQL\ConstrainsEagerLoads;
|
|
use App\Concerns\Actions\GraphQL\FiltersModels;
|
|
use App\GraphQL\Schema\Types\BaseType;
|
|
use GraphQL\Type\Definition\ResolveInfo;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class ShowAction
|
|
{
|
|
use ConstrainsEagerLoads;
|
|
use FiltersModels;
|
|
|
|
public function show(Builder $builder, array $args, BaseType $type, ResolveInfo $resolveInfo): Model
|
|
{
|
|
$this->withAggregates($builder, $args, $this->getSelection($resolveInfo), $type);
|
|
|
|
$this->filter($builder, $args, $type);
|
|
|
|
$this->constrainEagerLoads($builder, $resolveInfo, $type);
|
|
|
|
return $builder->firstOrFail();
|
|
}
|
|
}
|