0
我有3個型號:User,Program,UserProgram。 UserProgram是它自己的實際模型。Laravel HasManyThrough Keys
這裏是車型的外觀在數據庫:
- 用戶
- ID
- 程序
- ID
- 個user_programs
- USER_ID
- program_id
我想在我的計劃模型:
function users() {
return $this->hasManyThrough('App\User','App\UserProgram');
}
但是,這是行不通的。我怎樣才能使這種關係起作用?
太謝謝你了!這非常有幫助! – Aaron