laravel class user not found in Controller and if in Tinker

0

I'm relating User with same, in Tinker everything works fine, it creates a record in the pivot table

 ejemplo en Tinker todo OK
  $p=App\User::find(246)
  $u=App\User::find(247)
  $u->addParent($p)

But in the controller it does not work gives error

  

"class User not found"

    public function parents()


{
    return $this->belongsToMany('User', 'parent_user', 'user_id','parent_id' 
 );
}

public function addParent(User $user)
{       
    $this->parents()->attach($user->id);

}
    
asked by Claudio Fernando 20.05.2018 в 02:28
source

0 answers