37 lines
779 B
PHP
37 lines
779 B
PHP
<?php
|
|
|
|
namespace App\Services\Admin;
|
|
|
|
use App\Models\Banner;
|
|
use App\Filters\BannerFilter;
|
|
|
|
/**
|
|
* @method Banner getModel()
|
|
* @method Banner|\Illuminate\Database\Query\Builder query()
|
|
*/
|
|
class BannerService extends BaseService
|
|
{
|
|
protected string $modelName = Banner::class;
|
|
|
|
protected array $withRelationships = ['place'];
|
|
|
|
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->sort();
|
|
}
|
|
}
|