This package provide a simple way to retrive usefull metadata from laravel models
- find all models inside a psr-4 directory structure
- retrieve all columns and metadata from database
- retrieve indexes metadata
- generate basic validation rules using metadata
- model type hinting removed, you can use https://github.com/barryvdh/laravel-ide-helper
You can install the package via composer:
composer require ivanomatteo/laravel-model-utils
use IvanoMatteo\ModelUtils\ModelUtils;
dump(ModelUtils::findModels());
$mu = new ModelUtils(\App\User::class);
dump('id visible:',$mu->isVisible('id'));
dump('password visible:',$mu->isVisible('password'));
dump($mu->getValidationRules());
dump($mu->getValidationRules(true)); //also for not fillable fields
dump($mu->getMetadata());
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
- Ivano Matteo
- Thanks also to Barry vd. Heuvel for his libraries, i took some pices of code from ide helper
- All Contributors
The MIT License (MIT). Please see License File for more information.