问题.php
public function votes()
{
return $this->morphToMany('App\User' , 'votable');
}
用户.php
public function voteQuestions()
{
return $this->morphedByMany('App\Answer', 'votable');
}
这显示:
调用未定义的方法 Illuminate\Database\Eloquent\Relations\MorphToMany::exits()
Laravel 会告诉你:
您的意思是 Illuminate\Database\Eloquent\Relations\MorphToMany::get() 吗?