123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace App\Distributor\Repositories;
- use App\Models\SitePages as Model;
- use Dcat\Admin\Repositories\EloquentRepository;
- class SitePages extends EloquentRepository
- {
- /**
- * 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();
- }
- }
|