PHP code example of vicgutt / laravel-models-finder
1. Go to this page and download the library: Download vicgutt/laravel-models-finder library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vicgutt / laravel-models-finder example snippets
// On an app containing only the default Laravel "User" model, running:
$models = ModelsFinder::find()
->map(static fn (ModelData $model): array => [
'path' => $model->path,
'class' => $model->class,
])
->toArray();
// would return the following:
[
[
'path' => '/[...]/my-project/app/Models/User.php',
'class' => '\App\Models\User',
],
]