Answer the question
In order to leave comments, you need to log in
How to find out the list of methods?
In general, I study Laravel and then I realized that in my IDE (by pressing ctrl + space) the entire list of class methods is not displayed. So the question is, how can I find out all the methods of a class, including the fact that it inherited from 100500 classes? If not for the video, I would not have learned soon that such methods exist, hehe.
For example, here is a small piece of code:
ModelArticle is inherited from Model. (Laravel framework) $articles = ModelArticle::latest()->get();
So the IDE knows nothing about the latest() method! What to do, how to be? :)
Answer the question
In order to leave comments, you need to log in
You need to install ide-helper and inherit models from \Eloquent
, not from \Illuminate\Database\Eloquent\Model
, then the IDE will see more methods (but still not all).
Instead of using facades, use the wonderful DI
public function fooAction(ModelArticle $modelArticles) {
return $modelArticles->latest();
}
Well, latest is not done through stupid scopes, but by the normal method of the model.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question