12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- class TopicInfo extends Model
- {
- use HasFactory;
- protected $table = 'topic_info';
- public $timestamps = false;
- protected static $unguarded = true;
- /**
- * 获取专题列表
- * */
- public static function topicList($page, $pageSize)
- {
- $topicModel = self::where('enable', 1);
- $count = $topicModel->count();
- $list = $topicModel->select(['id', 'topic_name', 'topic_pic', 'topic_desc', 'create_time'])
- ->orderBy('sort_num', 'desc')
- ->offset(($page-1) * $pageSize)
- ->limit($pageSize)
- ->get();
- return [$list, $count];
- }
- }
|