'已删除', self::IS_DEL_NO => '未删除' ]; /** * The table associated with the model. * * @var string */ protected $table = 'travel_line'; public $timestamps = false; /** * Notes:获取线路列表 * @param string $keywords * @param int $page * @param int $limit * @return array * User: YCP * Date: 2023/05/16 */ public static function getLineList() { $list = static::select('*') ->where(['line_is_del'=>static::IS_DEL_NO]) ->orderBy('line_create_time','DESC') ->get(); foreach ($list as &$v) { $v['line_tags'] = explode(",",$v['line_tags']); } $count = static::where(['line_is_del'=>static::IS_DEL_NO]) ->count(); return [$list, $count]; } //时间格式 public function getLineCreateTimeAttribute($value) { return date('Y-m-d H:i:s', $value); } //关联套餐内项目 public function LineDate(){ return $this->hasMany(TravelDate::class,'line_id','line_id')->where(['date_is_del'=>0]); } //关联店铺 public function Shop(){ return $this->belongsTo(MerchantShop::class,'shop_id','shop_id'); } }