generated from panliang/owl-admin-starter
41 lines
821 B
PHP
41 lines
821 B
PHP
<?php
|
|
|
|
namespace App\Admin\Services;
|
|
|
|
use App\ModelFilters\UserRankFilter;
|
|
use App\Models\UserRank;
|
|
|
|
class UserRankService extends BaseService
|
|
{
|
|
protected array $withRelationships = ['user', 'cate'];
|
|
|
|
protected string $modelName = UserRank::class;
|
|
|
|
protected string $modelFilterName = UserRankFilter::class;
|
|
|
|
public function listQuery()
|
|
{
|
|
$filter = $this->getModelFilter();
|
|
|
|
$query = $this->query();
|
|
if ($this->withRelationships) {
|
|
$query->with($this->withRelationships);
|
|
}
|
|
|
|
if ($filter) {
|
|
$query->filter(request()->input(), $filter);
|
|
}
|
|
|
|
return $query->sort();
|
|
}
|
|
|
|
public function list()
|
|
{
|
|
$query = $this->listQuery();
|
|
|
|
$items = (clone $query)->get();
|
|
|
|
return compact('items');
|
|
}
|
|
}
|