Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
特定の computer_type (users->computers->computer_type) に属する多くのコンピューターを持つユーザーがいるとします。
ユーザーとそのコンピューターの両方を次のようにロードできることを知っています。User::with("Computer")
User::with("Computer")
3つすべてをロードしたいと思います。Laravelでどうすればできますか?
はるか下の関係を取得するには、子、次にその子を持つ子、というように言う必要があります...
User::with(array('computer', 'computer.type'))->find(1);
ユーザー has_one この特定のシナリオでは、コンピュータには has_one タイプがあります。
試す
Appointment::with('kid.parent')->get()
各子供に予定があり、各子供に親がいる場合。