Answer the question
In order to leave comments, you need to log in
Why can't I access the model method for the link?
BadMethodCallException
Method Illuminate\Database\Eloquent\Collection::category does not exist.
-------------------------------------------------- ------------------------------------
if($take) {
$builder->take($take);
}
if($where) {
$builder->where($where[0],$where[1]);
}
if($orderBy){
$builder->orderBy('id','DESC');
}
if($pagination) {
$builder->paginate(Config::get('settings.paginate_home'));
}
$articles=$builder->category();
Answer the question
In order to leave comments, you need to log in
From what I see, $builder
you have a collection, and the method category()
is probably a method of the model, which, in theory, should be in this collection. The collection itself has no such method, hence the Exception. Looks like it will help you $builder->first()->category()
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question