Download the PHP package cybex/laravel-reflector without Composer
On this page you can find all versions of the php package cybex/laravel-reflector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cybex/laravel-reflector
More information about cybex/laravel-reflector
Files in cybex/laravel-reflector
Package laravel-reflector
Short Description Provides structural information about data Models.
License MIT
Homepage https://github.com/cybex-gmbh/laravel-reflector
Informations about the package laravel-reflector
Laravel Reflector
This package allows you to get structural information for data models.
Requirements
- Illuminate/support: ^8.0
- PHP: ^8.0
Installation
You can install the package via composer:
Usage
getModelRelations()
The method returns a Collection of all relations of a Model, with additional information like the name of the relation, relation type, related class and an empty base instance of the given Model from Eloquent.
getRelationByTarget()
The method returns the name of a Relation between the Model and the Target.
hasRelation()
The method returns true if a Model has a specific relation.
getMethodReturnType()
The method returns the type of a specific method on a given Object or Model class. It returns false when the Method does not exist. It returns null if no return type is type hinted.
getModelInstance()
The method checks if the given model is an instance of a Model or the fully qualified class name of a Model, and returns the model or the empty Eloquent base Model of the given class.
getModelClass()
The method checks if the given model is an instance of a Model or the fully qualified class name of a Model, and returns the class of the given Model.
resolveModelObject()
The method resolves a Model based on a given Model or a Class and the according identifier. If no identifier is given, it returns an empty Builder-Model. If the desired Model can not be found, it will return null.
resolveRelatedModel()
The method resolves a related Model by the source and the given Relation. Currently, we only support HasOne or BelongsTo-Relations, as those only return a single Model or null.
resolveRelatedModelByTarget()
The method resolves a related Model by the source and the given TargetModel.
getModelShortName()
The method returns the Short-Name of a Model.
getAllModels()
The method returns a Collection of all available Models via the Filesystem.
getAllInstantiatableModels()
The method returns a Collection of all instantiatable Model-Classes, which are not Abstract. It returns the full qualified Class-Name as key with the according Short-Name as value.
getInstantiatableModelStructureInformation()
The method returns a Collection of structure information for all instantiatable Model-Classes, which include the fully qualified name of the parent class and the child classes.
getClassFromMorphMap()
The method returns the class name from the Morph-Map alias (reverse lookup), the alias or null (if strict is true).
getMorphAliasForClass()
The method returns the morph alias for the specified Model.
modelHasTraits()
The method validates if a Model implements one or more specific Traits.