-
Notifications
You must be signed in to change notification settings - Fork 0
Relations
Marco E edited this page Aug 28, 2020
·
4 revisions
- We need to add relationships using the Eloquent ORM.
- In the
User
model, we need to specify that one meeting can be associated with many users. We do this by using a Many To Many relationship. Many-to-many relationships are defined by writing a method that returns the result of thebelongsToMany
method:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
/**
* The meetings that belong to the user.
*/
public function meetings()
{
return $this->belongsToMany('App\Meeting');
}
}
meeting-API - 2020