mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-06-10 21:07:37 +08:00
user-list
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class BaseRepository
|
||||
{
|
||||
protected function getSortFieldAndType(array $params)
|
||||
{
|
||||
$field = $params['sort_field'] ?? 'id';
|
||||
$type = 'desc';
|
||||
if (!empty($params['sort_type']) && Str::startsWith($params['sort_type'], 'asc')) {
|
||||
$type = 'asc';
|
||||
}
|
||||
return [$field, $type];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user