mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-16 05:50:55 +08:00
user-list
This commit is contained in:
18
app/Repositories/BaseRepository.php
Normal file
18
app/Repositories/BaseRepository.php
Normal file
@@ -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