BadMethodCallException with message 'Call to undefined method Illuminate\Database\Query\Builder::belongToMany()'
问题 Following the instructions in this laracast : https://laracasts.com/series/laravel-5-fundamentals/episodes/21 I created a Channel model class Channel extends Model { // protected $fillable = [ 'title', 'description', 'published_at', ]; public function scopePublished($query) { $query->where('published_at', '<=', Carbon::now()); } public function setPublishedAtAttribute($date) { $this->attributes['published_at'] = Carbon::createFromFormat('Y-m-d', $date); } /* * Get the tags associated with the