أتقن العلاقات المتقدمة في Eloquent:
Has One Through
public function latestPost()
{
return $this->hasOneThrough(Post::class, Author::class)->latest();
}Many to Many مع بيانات Pivot
$user->roles()->attach($roleId, ['expires_at' => now()->addYear()]);العلاقات متعددة الأشكال
public function commentable()
{
return $this->morphTo();
}تتعامل هذه العلاقات مع هياكل البيانات المعقدة بأناقة.