Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Models

is there any way to list all of the Modals that i have created ?



65.9k
Accepted
answer

Doubt there is framework who has such functionality without preregistering the models or autoloading them.

However a quick and not so dirty solution would be something like:

$dir = 'path-to-your-models-folder';
foreach (array_diff(scandir($dir), ['.', '..']) as $file) {
    echo $file, '<br/>';
}

// Outputs (in sample project of mine)
AdminLogs.php
AdminUsers.php
BaseModel.php
Campaigns.php
FormRequests.php
Redirects.php
Settings.php
SettingsI18n.php
Translations.php
TranslationsI18n.php
Uploads.php
UploadsI18n.php
....
....
....

And you can always get rid of the .php extension easily :)