generated from panliang/owl-admin-starter
33 lines
709 B
PHP
33 lines
709 B
PHP
<?php
|
|
|
|
namespace App\Admin\Services;
|
|
|
|
use App\ModelFilters\BannerFilter;
|
|
use App\Models\Banner;
|
|
|
|
class BannerService extends BaseService
|
|
{
|
|
protected array $withRelationships = ['place'];
|
|
|
|
protected string $modelName = Banner::class;
|
|
|
|
protected string $modelFilterName = BannerFilter::class;
|
|
|
|
public function listQuery()
|
|
{
|
|
$model = $this->getModel();
|
|
$filter = $this->getModelFilter();
|
|
|
|
$query = $this->query();
|
|
if ($this->withRelationships) {
|
|
$query->with($this->withRelationships);
|
|
}
|
|
|
|
if ($filter) {
|
|
$query->filter(request()->input(), $filter);
|
|
}
|
|
|
|
return $query->orderBy('place_id')->sort();
|
|
}
|
|
}
|