Can I use hasOneThrough two relations?

Viewed 22

I have four tables with one¹-to-many* relationships like below:

A ¹ ⎯ * B ¹ ⎯ * C ¹ ⎯ * D

  • D has one C,
  • C has one B,
  • B has one A.

In D model, I have:

**
 * Get B.
 */
public function b()
{
    return $this->hasOneThrough(B::class, C::class);
}

Can I have another function to get A from D through C and B ?

0 Answers
Related