<?php

namespace App\Distributor\Repositories;

use App\Models\DistVideo as Model;
use App\Traits\DistSlugTrait;
use Dcat\Admin\Repositories\EloquentRepository;

class DistVideo extends EloquentRepository
{
    use DistSlugTrait;

    /**
     * Model.
     *
     * @var string
     */
    protected $eloquentClass = Model::class;


    public static function findById($id)
    {
        return Model::find($id); // 查找并返回相应的记录
    }

    /*
     * 查找最新的N个文章
     */
    public static function selectOptionsNew($limit=30)
    {
        return Model::where('dist_id', getDistributorId())->orderBy('created_at', 'desc')->limit($limit)->pluck('title', 'id');
    }
}
