【发布时间】:2015-06-08 05:05:54
【问题描述】:
商业模式
class Business extends \Eloquent implements UserInterface, RemindableInterface{
public function services()
{
return $this->hasMany('Services');
}
}
服务模式
class Service extends \Eloquent {
public function business()
{
return $this->belongsTo('Business');
}
public function tag()
{
return $this->belongsToMany('Tag','service_tags','service_id','tag_id');
}
}
标签模式
class Tag extends \Eloquent {
public function service()
{
return $this->belongsToMany('Service','service_tags','service_id','tag_id');
}
}
现在我想通过标签 id 检索企业的服务。 那我该怎么办????
【问题讨论】:
-
您能否详细解释一下您的问题,您想要通过标签 id 的企业还是具有特定标签 id 的企业服务?
-
实际上我有业务和该业务的所有服务。现在我想按标签对服务进行排序
-
如果你这么问,那么你的问题是错误的,请修改。我已经更新了我的答案。
标签: php mysql laravel-4 eloquent