问题描述:

I have a table votes that looks like this:

id

user_id

votable_id

votable_type

status

I need to be able to set the status so I thought this would work:

class Comment extends Model

{

public function votes(){

return $this->morphMany(Vote::class, 'votable')->withPivot('status');

}

}

However that gives this error:

BadMethodCallException with message 'Call to undefined method Illuminate\Database\Query\Builder::withPivot()'

相关阅读:
Top