Recommend.php 693 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: admin
  5. * Date: 2018/8/17
  6. * Time: 11:02
  7. */
  8. namespace App\Modules\RecommendBook\Models;
  9. use Illuminate\Database\Eloquent\Model;
  10. class Recommend extends Model {
  11. protected $table = 'recommend_books';
  12. protected $fillable = ['id','bid','channel','sequence','version_id','subject','is_show'];
  13. public static function getRecommendIds($channel,$type){
  14. $recommends = self::where([
  15. ['is_show','=',1],
  16. ['channel','=',$channel],
  17. ['subject','=',$type]
  18. ])
  19. ->select('bid')
  20. ->orderBy('sequence','asc')
  21. ->get();
  22. return $recommends;
  23. }
  24. }