如何在laravel 4中检索多态关系的多个所有者

如何在laravel 4中检索多态关系的多个所有者,laravel,polymorphic-associations,laravel-4,eloquent,Laravel,Polymorphic Associations,Laravel 4,Eloquent,下面列出了3个表: 使用者 命令 id price 历史 id historable_id historable_type 我想在orders视图中检索具有特定历史id的所有订单 订单型号: public function history(){ return $this->morphMany('History','historable');} 订单管理员: public function index(){ var_dump(History::find(

下面列出了3个表:
使用者

命令

id price  
历史

id historable_id historable_type 
我想在orders视图中检索具有特定历史id的所有订单

订单型号:

public function history(){  
    return $this->morphMany('History','historable');} 
订单管理员:

public function index(){  
    var_dump(History::find(1)->historable->toArray());}  

有多个订单的历史id为1,但只找到第一个订单。如何获取具有相同历史id的所有其他记录?

为了总结评论中的讨论,解决方案是基于“historable_id”列而不是常规列检索记录

History::where('historable_id', '=', '1')->get();
或者:

Order::find(1)->history;

也许我误解了,但是您不想做History::where('historable_id','=','1')->get()?当前检索的是ID为1的历史记录表中的行,而不是ID为1的与订单匹配的所有行。find()正在查看历史表上的“id”列,您希望查看“historable_id”列。谢谢,您是对的。
Order::find(1)->history;