Search Results For: relationship
Showing 1 to 1 of 1 blog articles.
2238 views · 146 days ago

![Laravel Eloquent Relationship Part 1](https://images.ctfassets.net/vzl5fkwyme3u/2iNUlfYJ8SZVYUSemRAszt/eeb78994b12f1491f654d77026ab6c33/AdobeStock_199075029.png?w=1000)

Laravel introduces eloquent relationships from laravel 5.0 onwards. We all know, while we creating an application we all have foreign keys. Each table will be connected to some other. Eloquent make easy to connect each tables easily. Here we will One to one, one to many and many to many relationships. Here we will see three types of relationships,

1. One to one relationships

2. One to many relationships

3. Many to many relationships

## Why Eloquent Relationships

Here we have 2 tables, students and marks, so for join each table,

```php

$student = student::join(‘marks’,’marks.student_id,’=’,students.id’)->where(‘students.id’,’1’)->get();

dd($student);

```

the above query is to l...

    SPONSORS

    Faster PHP Cloud Hosting