I have a group of Users that have Many To Many relationship, to create this relationship I made a beLongsToMany function within the Users model. But every time I call this function I get the following message:
Uncaught exception 'BadMethodCallException' with message 'Call to undefined method Illuminate \ Database \ Query \ Builder :: People ()'
public function Pessoas(){
return $this->belongsToMany('entidades\Pessoas', 'pessoa_id');
}
Call:
Usuarios::where('usuario_id', $usuario_id)->Pessoas()->toSql();
For each of my users I want to get people's records.