class Space extends Model
{
public function meetingroom()
{
return $this->hasMany(‘meetingroom’,’space_id’)->field(‘price_per_hour’);
}
public function getIndustryAttr($value)
{
return $value ? explode(‘,’,$value) : [];
}
public function getPicturesAttr($value)
{
return $value ? explode(“\n”,$value) : [];
}
}
$arrMeetingroomList = Space::hasWhere(‘meetingroom’,[‘status’=>1])
->field([‘Meetingroom.price_per_hour’])
->where([‘Space.status’=>1])
->where(‘Space.industry’,’like’,’%’.$this->userInfo[‘tags’].’%’)
->group(‘Space.id’)
->order(‘Meetingroom.price_per_hour’)
->limit(10)
->select();