taktik - laravel
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Services\QueryRequestModifiers\Comment;
|
||||
|
||||
use App\Services\QueryRequestModifiers\OrderableDTO;
|
||||
use App\Services\QueryRequestModifiers\SortDirection;
|
||||
|
||||
/**
|
||||
* @implements OrderableDTO<CommentOrderDTO>
|
||||
*/
|
||||
readonly class CommentOrderDTO implements OrderableDTO
|
||||
{
|
||||
public function __construct(public string $column, public SortDirection $direction)
|
||||
{
|
||||
}
|
||||
|
||||
public function toCacheKey(): string
|
||||
{
|
||||
return $this->column . '|' . $this->direction->value;
|
||||
}
|
||||
|
||||
public function getColumn(): string
|
||||
{
|
||||
return $this->column;
|
||||
}
|
||||
|
||||
public function getDirection(): SortDirection
|
||||
{
|
||||
return $this->direction;
|
||||
}
|
||||
|
||||
public static function createFromValues(string $column, SortDirection $sortDirection): OrderableDTO
|
||||
{
|
||||
return new self(
|
||||
$column,
|
||||
$sortDirection
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user