Model
in package
Database Model Factory
Table of Contents
Properties
- $instances : array<string|int, mixed>
- Instance pool
Methods
- __callStatic() : object|null
- Create model
- create() : object|null
- Create db model instance
- getConstant() : mixed
- Get model constant
- getSql() : string
- Get sql
- hasAttribute() : bool
- Return true if attribute exist
- isValidModel() : bool
- Return true if instance is valid model class
Properties
$instances
Instance pool
private
static array<string|int, mixed>
$instances
= []
Methods
__callStatic()
Create model
public
static __callStatic(string $name, array<string|int, mixed> $args) : object|null
Parameters
- $name : string
- $args : array<string|int, mixed>
Return values
object|nullcreate()
Create db model instance
public
static create(string $className[, string|null $extensionName = null ][, Closure|null $callback = null ][, bool $showError = true ]) : object|null
Parameters
- $className : string
-
Base model class name
- $extensionName : string|null = null
- $callback : Closure|null = null
- $showError : bool = true
Tags
Return values
object|nullgetConstant()
Get model constant
public
static getConstant(string $className, string $constantName[, string|null $extensionName = null ]) : mixed
Parameters
- $className : string
- $constantName : string
- $extensionName : string|null = null
getSql()
Get sql
public
static getSql(Builder $builder) : string
Parameters
- $builder : Builder
Return values
stringhasAttribute()
Return true if attribute exist
public
static hasAttribute(Model $model, string $name) : bool
Parameters
- $model : Model
- $name : string
Return values
boolisValidModel()
Return true if instance is valid model class
public
static isValidModel(object $instance) : bool
Parameters
- $instance : object