mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
23 lines
510 B
PHP
23 lines
510 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\GraphQL\Criteria\Sort;
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
|
class FieldSortCriteria extends SortCriteria
|
|
{
|
|
/**
|
|
* Apply the ordering to the current Eloquent builder.
|
|
*/
|
|
public function sort(Builder $builder): Builder
|
|
{
|
|
$column = $this->sortCase->shouldQualifyColumn()
|
|
? $builder->qualifyColumn($this->column)
|
|
: $this->column;
|
|
|
|
return $builder->orderBy($column, $this->direction->value);
|
|
}
|
|
}
|