1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace App\Distributor\Repositories;
- use App\Models\SitePages as Model;
- use App\Traits\DistSlugTrait;
- use Dcat\Admin\Repositories\EloquentRepository;
- class SitePages extends EloquentRepository
- {
- use DistSlugTrait;
- /**
- * Model.
- *
- * @var string
- */
- protected $eloquentClass = Model::class;
- /*
- * 查找最新的N个文章
- */
- public static function selectOptionsNew($limit=30)
- {
- return Model::where('dist_id', getDistributorId())->where('status', 1)->orderBy('created_at', 'desc')->limit($limit)->pluck('title', 'id');
- }
- /*
- * 获取一个标签
- */
- public static function getOneById($id)
- {
- return Model::where('id', $id)->where('dist_id', getDistributorId())->first();
- }
- }
|