36 lines
763 B
PHP
36 lines
763 B
PHP
<?php
|
|
|
|
namespace App\Services\Admin;
|
|
|
|
use App\Models\Article;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Illuminate\Support\Str;
|
|
|
|
/**
|
|
* @method Article getModel()
|
|
* @method Article|\Illuminate\Database\Query\Builder query()
|
|
*/
|
|
class ArticleService extends BaseService
|
|
{
|
|
protected array $withRelationships = ['category'];
|
|
|
|
protected string $modelName = Article::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();
|
|
}
|
|
}
|