{"repo":"spatie/laravel-model-info","free":true,"listed":false,"github":"https://github.com/spatie/laravel-model-info","clone":"git clone https://github.com/spatie/laravel-model-info.git","description":"Get information on all the models in your Laravel project","language":"PHP","stars":183,"topics":["eloquent","laravel","models","php","reflection"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"Get information about the models in your Laravel app Using this package you can determine which attributes and relations your model classes have. Here's how you can get information about the attributes: Here's how you can get information about the relations Additionally, the package can also discover all the models in your application. Support us We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products. We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall. Installation You can install the package via composer: Usage You can get information about a model by calling forModel : Note This package discovers relationships by their return type. Make sure that, in all your models each method that returns a relation has a return type. Getting a specific attribute Getting a specific relation You can get a specific relation using the relation method. Attributes A Spatie\\ModelInfo\\Attributes\\Attribute object has these properties: - name - type - increments - nullable - default - unique - fillable - appended - cast - virtual Relationships A Spatie\\ModelInfo\\Relations\\Relation object has these properties: - name - type - related It also has a relatedModelInfo() method that gives a ModelInfo instance for the related model. Discovering all models i","default_branch":null,"files":null,"tree":[],"storefront":"/r/spatie","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/spatie/laravel-model-info/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}