Showing Articles for Relationships

Apr 27, 2015

One to one relationship in laravel

One to one relationship of two objects in which one can only belongs to the other. Using of belongsTo() method.

Apr 29, 2015

Has Many Relationship( One to many )

One to many relationship is is most commonly used relationship, Where in this example I will show you a book has only one author, But author can have many books.

May 1, 2015

Many to many relationship( belongsToMany )

Belongs to many is a combination of belogsTo and hasMany. When a table one or more rows associated with another table one or more rows that called many to many relationship. In this example we will see a user associated with multiple roles and a role associated with multiple users.