Open screenager opened 3 years ago
It's not how it works. I built the package with all my model in App/Models
. It scans all the classes loaded and only gets the one extending the Model
class. Could you please give more details about your exact issue?
https://github.com/JhumanJ/laravel-model-stats/blob/main/src/Http/Controllers/HomeController.php#L29
Could be 2 issues here indeed. My models extend a parent class, before that one extends Model.
So File::allFiles(app_path()
does a deep search ? Perhaps I didn't debug this well.
Whereas isSubclassOf(Model::class)
does not look one level higher?
I've just done a test where I have a model A extending a class B (itself extending model), and it worked just fine. Can you share details about your environment, and give more details about how to reproduce the issue?
Did some more debugging. I think being able to specify the models directory, and only scan that models directory, is a better solution for big projects with a lot of deprecated code.
In my case, getModels() fails on scanning some unused Console/Commands (with a broken dependency) and some other helper files (that aren't real classes with namespaces).
I shall take a look at this.
When looking into HomeController getModels(), I think the package is only scanning the App/ directory, and not App/Models. Perhaps make this configurable?