Download the PHP package cerbero/eloquent-inspector without Composer
On this page you can find all versions of the php package cerbero/eloquent-inspector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cerbero/eloquent-inspector
More information about cerbero/eloquent-inspector
Files in cerbero/eloquent-inspector
Package eloquent-inspector
Short Description Inspect Laravel Eloquent models to collect properties, relationships and more.
License MIT
Homepage https://github.com/cerbero90/eloquent-inspector
Informations about the package eloquent-inspector
🕵️ Eloquent Inspector
Inspect Laravel Eloquent models to collect properties, relationships and more.
Install
Via Composer
Usage
To inspect an Eloquent model, we can simply pass its class name to the inspect()
method:
An Inspector
singleton is created every time a new model is inspected, this lets us inspect the same model multiple times while running the inspection logic only once.
If we need to free memory or cleanup some inspected model information, we can either flush all model inspections, flush only one model inspection or tell an inspection to forget its data:
To retrieve the class of the inspected model from an Inspector
, we can call getModel()
:
The method getUseStatements()
returns an array with all the use
statements of a model, keyed by either the class name or the alias:
Calling getProperties()
performs a scan of the model database table and returns an array of Property
instances containing the properties information. The array is keyed by the properties name:
To inspect the relationships of a model, we can call the method getRelationships()
. The result is an array of Relationship
instances, keyed by the relationship name, containing all the relationships information:
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
Contributing
Please see CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Andrea Marco Sartori
- All Contributors
License
The MIT License (MIT). Please see License File for more information.