菜谱项目

RecommendTag.php 651B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Illuminate\Support\Facades\DB;
  5. class RecommendTag extends Model
  6. {
  7. protected $table = 'recommend_tag';
  8. public $timestamps = false;
  9. public static function selectRecommendTag($status=1){
  10. $tagDataList=DB::table('recommend_tag')->select('id','name','url')->where('status',$status)->offset(0)->limit(5)->get()->toArray();
  11. if(!empty($tagDataList)){
  12. $tagDataList[5]=["id"=>6,'name'=>'更多','url'=>'https://apicaipu.726p.com/Uploads/RecommendTag/more.png'];
  13. }
  14. if(empty($tagDataList)){
  15. return [];
  16. }
  17. return $tagDataList;
  18. }
  19. }