Is there a way to fetch all existing models in Laravel 4? The documentation says nothing about this and googling the issue didn't result in anything relevant.
I'm working on a feature in my current project that needs the ability to create a report of which assets there are or which customer has bought which asset at the company. For that, I'm creating a module that allows the user to specify what information goes on which worksheet (exports to Excel).
Let's say I have the following models (They all extend Eloquent):
- Asset
- Customer
- Country
- Keys
- User
I only want the Asset and Customer model to be usable in the report. My idea is to give those a constant and check on that constant.
The only thing I'm bumping my head against is a way to fetch all the models that are defined in my Laravel application.
I know I could loop through the app/models directory or create an array somewhere but I'm looking for a better way of doing this. Does anyone happen to know how to achieve this?