1
I have a group of Users who have relationship Many To Many, to create this relationship I did a function beLongsToMany within the model Usuarios. 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');
}
Calling for:
Usuarios::where('usuario_id', $usuario_id)->Pessoas()->toSql();
For each of my users I want to get people’s records.
Interesting, I will try to use this approach as well. Thank you
– Alexandre Vieira de Souza