لاراول

روابط Eloquent

Eloquent Relationships

Eloquent make the process of interacting with your database tables as natural and intuitive as possible. It's vital that you recognize and understand six key relationship types. Let's review them all - one episode per relationship.

سطح مبتدی 6 جلسه آموزشی 01:25:00 ساعت
01
قسمت 1

One to One

First up, we have "one to one" relationships. This is an easy one to picture in your head. What is one thing that a user might be associated with? What about a profile, or an address, or an avatar?

02
قسمت 2

One to Many

Now that we have "one-to-one" relationships locked and loaded, let's move on to our next Eloquent relationship: "one-to-many." What might be an example of something a user would have many of? What about posts, or projects, or tasks? You'll reach for...

03
قسمت 3

Many to Many

Many to many relationships are a bit more confusing to understand. Let's break it down by reviewing the common "posts" and "tags" relationship. A one-to-one or one-to-many relationship isn't quite right here. A post will never own a tag. It can be as...

04
قسمت 4

Has Many Through

While not nearly as common, the hasManyThrough relationship, when necessary, can prove to be incredibly useful. This relationship type allows you to perform queries across long-distance relationships.

05
قسمت 5

Polymorphic Relations

We've made it to the scariest of Eloquent relations: polymorphic. Don't worry! As with most things, the word is scarier than the technique. A polymorphic relationship allows a model to belong to any number of models on a single association. Let's dem...

06
قسمت 6

Many to Many Polymorphic Relations

We've finally made it to the most intimidating of Eloquent relationships: many to many polymorphic. Don't worry; it's far simpler to understand than you might initially think. In this lesson, we'll construct a standard many-to-many relationship: a us...

دوره در حال اجرا

این دوره هنوز به پایان نرسیده است و در آینده درس های دیگری به آن افزوده خواهد شد.