You have declared:
public function school()
{
return $this->belongsToMany('School');
}
But using $user->schools
, you should change the function declaration to schools
:
public function schools()
{
//...
}
Also make sure that, you are using the right relationship, I'm confussed because one user may belongs to only one school (logically).