如何访问此数据透视表字段

时间:2015-08-11 23:27:31

标签: laravel eloquent

我正试图像这样访问一个数据透视字段:

(-117.25624, 32.85563)(-117.25648000000001,32.855470000000004 )(-117.25710000000001,32.85567 )(-117.2556,32.85544 )
(-121.44142000000001,37.75363 )(-121.4414,37.75292 )

但是我收到了这个错误:

  

调用未定义的方法Illuminate \ Database \ Query \ Builder :: pivot()

在我的视图中,我形成了$attendee_waitlisted->pivot('order_number') ,如此:

$attendee_waitlisted

我可以在HTML输出中看到我的{{$attendee_waitlisted = $program->waitlist->attendees->find($attendee)}} 字段:

order_number

如何访问该字段?

1 个答案:

答案 0 :(得分:1)

您应该可以按如下方式访问数据透视字段:

$attendee_waitlisted->pivot->order_number