mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
23 lines
500 B
PHP
23 lines
500 B
PHP
<?php
|
|
|
|
namespace App\Repositories;
|
|
|
|
use Illuminate\Encryption\Encrypter;
|
|
use Illuminate\Support\Str;
|
|
|
|
class BaseRepository
|
|
{
|
|
private static $enctyper;
|
|
|
|
protected function getSortFieldAndType(array $params): array
|
|
{
|
|
$field = !empty($params['sort_field']) ? $params['sort_field'] : 'id';
|
|
$type = 'desc';
|
|
if (!empty($params['sort_type']) && Str::startsWith($params['sort_type'], 'asc')) {
|
|
$type = 'asc';
|
|
}
|
|
return [$field, $type];
|
|
}
|
|
|
|
}
|