<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2018/8/17
 * Time: 11:02
 */
namespace App\Modules\RecommendBook\Models;

use Illuminate\Database\Eloquent\Model;

class Recommend extends Model {

    protected $table = 'recommend_books';
    protected $fillable = ['id','bid','channel','sequence','version_id','subject','is_show'];

    public static function getRecommendIds($channel,$type){
        $recommends = self::where([
                ['is_show','=',1],
                ['channel','=',$channel],
                ['subject','=',$type]
            ])
            ->select('bid')
            ->orderBy('sequence','asc')
            ->get();
        return $recommends;
    }
}