PHP Класс Jenssegers\Model\Model

Наследование: implements ArrayAcces\ArrayAccess, implements Illuminate\Contracts\Support\Arrayable, implements Illuminate\Contracts\Support\Jsonable, implements JsonSerializabl\JsonSerializable
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$snakeAttributes boolean Indicates whether attributes are snake cased on arrays.

Защищенные свойства (Protected)

Свойство Тип Описание
$appends array The accessors to append to the model's array form.
$attributes array The model's attributes.
$casts array The attributes that should be casted to native types.
$fillable array The attributes that are mass assignable.
$guarded array The attributes that aren't mass assignable.
$hidden array The attributes that should be hidden for arrays.
$mutatorCache array The cache of the mutated attributes for each class.
$unguarded boolean Indicates if all mass assignment is enabled.
$visible array The attributes that should be visible in arrays.

Открытые методы

Метод Описание
__callStatic ( string $method, array $parameters ) : mixed Handle dynamic static method calls into the method.
__construct ( array $attributes = [] ) : void Create a new Eloquent model instance.
__get ( string $key ) : mixed Dynamically retrieve attributes on the model.
__isset ( string $key ) : boolean Determine if an attribute exists on the model.
__set ( string $key, mixed $value ) : void Dynamically set attributes on the model.
__toString ( ) : string Convert the model to its string representation.
__unset ( string $key ) : void Unset an attribute on the model.
addHidden ( array | string | null $attributes = null ) : void Add hidden attributes for the model.
addVisible ( array | string | null $attributes = null ) : void Add visible attributes for the model.
attributesToArray ( ) : array Convert the model's attributes to an array.
cacheMutatedAttributes ( string $class ) : void Extract and cache all the mutated attributes of a class.
fill ( array $attributes ) Fill the model with an array of attributes.
fillable ( array $fillable ) Set the fillable attributes for the model.
forceFill ( array $attributes ) Fill the model with an array of attributes. Force mass assignment.
fromJson ( string $value, boolean $asObject = false ) : mixed Decode the given JSON back into an array or object.
getAttribute ( string $key ) : mixed Get an attribute from the model.
getAttributes ( ) : array Get all of the current attributes on the model.
getFillable ( ) : array Get the fillable attributes for the model.
getGuarded ( ) : array Get the guarded attributes for the model.
getHidden ( ) : array Get the hidden attributes for the model.
getMutatedAttributes ( ) : array Get the mutated attributes for a given instance.
getVisible ( ) : array Get the visible attributes for the model.
guard ( array $guarded ) Set the guarded attributes for the model.
hasGetMutator ( string $key ) : boolean Determine if a get mutator exists for an attribute.
hasSetMutator ( string $key ) : boolean Determine if a set mutator exists for an attribute.
hydrate ( array $items ) : array Create a collection of models from plain arrays.
isFillable ( string $key ) : boolean Determine if the given attribute may be mass assigned.
isGuarded ( string $key ) : boolean Determine if the given key is guarded.
isUnguarded ( ) : boolean Determine if current state is "unguarded".
jsonSerialize ( ) : array Convert the object into something JSON serializable.
newInstance ( array $attributes = [] ) : Model Create a new instance of the given model.
offsetExists ( mixed $offset ) : boolean Determine if the given attribute exists.
offsetGet ( mixed $offset ) : mixed Get the value for a given offset.
offsetSet ( mixed $offset, mixed $value ) : void Set the value for a given offset.
offsetUnset ( mixed $offset ) : void Unset the value for a given offset.
reguard ( ) : void Enable the mass assignment restrictions.
replicate ( array $except = null ) : Model Clone the model into a new, non-existing instance.
setAppends ( array $appends ) Set the accessors to append to model arrays.
setAttribute ( string $key, mixed $value ) Set a given attribute on the model.
setHidden ( array $hidden ) Set the hidden attributes for the model.
setVisible ( array $visible ) Set the visible attributes for the model.
toArray ( ) : array Convert the model instance to an array.
toJson ( integer $options ) : string Convert the model instance to JSON.
totallyGuarded ( ) : boolean Determine if the model is totally guarded.
unguard ( boolean $state = true ) : void Disable all mass assignable restrictions.
unguarded ( callable $callback ) : mixed Run the given callable while being unguarded.
withHidden ( array | string $attributes ) Make the given, typically hidden, attributes visible.

Защищенные методы

Метод Описание
asJson ( mixed $value ) : string Encode the given value as JSON.
castAttribute ( string $key, mixed $value ) : mixed Cast an attribute to a native PHP type.
fillableFromArray ( array $attributes ) : array Get the fillable attributes of a given array.
getArrayableAppends ( ) : array Get all of the appendable values that are arrayable.
getArrayableAttributes ( ) : array Get an attribute array of all arrayable attributes.
getArrayableItems ( array $values ) : array Get an attribute array of all arrayable values.
getAttributeFromArray ( string $key ) : mixed Get an attribute from the $attributes array.
getAttributeValue ( string $key ) : mixed Get a plain attribute (not a relationship).
getCastType ( string $key ) : string Get the type of cast for a model attribute.
hasCast ( string $key ) : boolean Determine whether an attribute should be casted to a native type.
isJsonCastable ( string $key ) : boolean Determine whether a value is JSON castable for inbound manipulation.
mutateAttribute ( string $key, mixed $value ) : mixed Get the value of an attribute using its mutator.
mutateAttributeForArray ( string $key, mixed $value ) : mixed Get the value of an attribute using its mutator for array conversion.

Описание методов

__callStatic() публичный статический Метод

Handle dynamic static method calls into the method.
public static __callStatic ( string $method, array $parameters ) : mixed
$method string
$parameters array
Результат mixed

__construct() публичный Метод

Create a new Eloquent model instance.
public __construct ( array $attributes = [] ) : void
$attributes array
Результат void

__get() публичный Метод

Dynamically retrieve attributes on the model.
public __get ( string $key ) : mixed
$key string
Результат mixed

__isset() публичный Метод

Determine if an attribute exists on the model.
public __isset ( string $key ) : boolean
$key string
Результат boolean

__set() публичный Метод

Dynamically set attributes on the model.
public __set ( string $key, mixed $value ) : void
$key string
$value mixed
Результат void

__toString() публичный Метод

Convert the model to its string representation.
public __toString ( ) : string
Результат string

__unset() публичный Метод

Unset an attribute on the model.
public __unset ( string $key ) : void
$key string
Результат void

addHidden() публичный Метод

Add hidden attributes for the model.
public addHidden ( array | string | null $attributes = null ) : void
$attributes array | string | null
Результат void

addVisible() публичный Метод

Add visible attributes for the model.
public addVisible ( array | string | null $attributes = null ) : void
$attributes array | string | null
Результат void

asJson() защищенный Метод

Encode the given value as JSON.
protected asJson ( mixed $value ) : string
$value mixed
Результат string

attributesToArray() публичный Метод

Convert the model's attributes to an array.
public attributesToArray ( ) : array
Результат array

cacheMutatedAttributes() публичный статический Метод

Extract and cache all the mutated attributes of a class.
public static cacheMutatedAttributes ( string $class ) : void
$class string
Результат void

castAttribute() защищенный Метод

Cast an attribute to a native PHP type.
protected castAttribute ( string $key, mixed $value ) : mixed
$key string
$value mixed
Результат mixed

fill() публичный Метод

Fill the model with an array of attributes.
public fill ( array $attributes )
$attributes array

fillable() публичный Метод

Set the fillable attributes for the model.
public fillable ( array $fillable )
$fillable array

fillableFromArray() защищенный Метод

Get the fillable attributes of a given array.
protected fillableFromArray ( array $attributes ) : array
$attributes array
Результат array

forceFill() публичный Метод

Fill the model with an array of attributes. Force mass assignment.
public forceFill ( array $attributes )
$attributes array

fromJson() публичный Метод

Decode the given JSON back into an array or object.
public fromJson ( string $value, boolean $asObject = false ) : mixed
$value string
$asObject boolean
Результат mixed

getArrayableAppends() защищенный Метод

Get all of the appendable values that are arrayable.
protected getArrayableAppends ( ) : array
Результат array

getArrayableAttributes() защищенный Метод

Get an attribute array of all arrayable attributes.
protected getArrayableAttributes ( ) : array
Результат array

getArrayableItems() защищенный Метод

Get an attribute array of all arrayable values.
protected getArrayableItems ( array $values ) : array
$values array
Результат array

getAttribute() публичный Метод

Get an attribute from the model.
public getAttribute ( string $key ) : mixed
$key string
Результат mixed

getAttributeFromArray() защищенный Метод

Get an attribute from the $attributes array.
protected getAttributeFromArray ( string $key ) : mixed
$key string
Результат mixed

getAttributeValue() защищенный Метод

Get a plain attribute (not a relationship).
protected getAttributeValue ( string $key ) : mixed
$key string
Результат mixed

getAttributes() публичный Метод

Get all of the current attributes on the model.
public getAttributes ( ) : array
Результат array

getCastType() защищенный Метод

Get the type of cast for a model attribute.
protected getCastType ( string $key ) : string
$key string
Результат string

getFillable() публичный Метод

Get the fillable attributes for the model.
public getFillable ( ) : array
Результат array

getGuarded() публичный Метод

Get the guarded attributes for the model.
public getGuarded ( ) : array
Результат array

getHidden() публичный Метод

Get the hidden attributes for the model.
public getHidden ( ) : array
Результат array

getMutatedAttributes() публичный Метод

Get the mutated attributes for a given instance.
public getMutatedAttributes ( ) : array
Результат array

getVisible() публичный Метод

Get the visible attributes for the model.
public getVisible ( ) : array
Результат array

guard() публичный Метод

Set the guarded attributes for the model.
public guard ( array $guarded )
$guarded array

hasCast() защищенный Метод

Determine whether an attribute should be casted to a native type.
protected hasCast ( string $key ) : boolean
$key string
Результат boolean

hasGetMutator() публичный Метод

Determine if a get mutator exists for an attribute.
public hasGetMutator ( string $key ) : boolean
$key string
Результат boolean

hasSetMutator() публичный Метод

Determine if a set mutator exists for an attribute.
public hasSetMutator ( string $key ) : boolean
$key string
Результат boolean

hydrate() публичный статический Метод

Create a collection of models from plain arrays.
public static hydrate ( array $items ) : array
$items array
Результат array

isFillable() публичный Метод

Determine if the given attribute may be mass assigned.
public isFillable ( string $key ) : boolean
$key string
Результат boolean

isGuarded() публичный Метод

Determine if the given key is guarded.
public isGuarded ( string $key ) : boolean
$key string
Результат boolean

isJsonCastable() защищенный Метод

Determine whether a value is JSON castable for inbound manipulation.
protected isJsonCastable ( string $key ) : boolean
$key string
Результат boolean

isUnguarded() публичный статический Метод

Determine if current state is "unguarded".
public static isUnguarded ( ) : boolean
Результат boolean

jsonSerialize() публичный Метод

Convert the object into something JSON serializable.
public jsonSerialize ( ) : array
Результат array

mutateAttribute() защищенный Метод

Get the value of an attribute using its mutator.
protected mutateAttribute ( string $key, mixed $value ) : mixed
$key string
$value mixed
Результат mixed

mutateAttributeForArray() защищенный Метод

Get the value of an attribute using its mutator for array conversion.
protected mutateAttributeForArray ( string $key, mixed $value ) : mixed
$key string
$value mixed
Результат mixed

newInstance() публичный Метод

Create a new instance of the given model.
public newInstance ( array $attributes = [] ) : Model
$attributes array
Результат Model

offsetExists() публичный Метод

Determine if the given attribute exists.
public offsetExists ( mixed $offset ) : boolean
$offset mixed
Результат boolean

offsetGet() публичный Метод

Get the value for a given offset.
public offsetGet ( mixed $offset ) : mixed
$offset mixed
Результат mixed

offsetSet() публичный Метод

Set the value for a given offset.
public offsetSet ( mixed $offset, mixed $value ) : void
$offset mixed
$value mixed
Результат void

offsetUnset() публичный Метод

Unset the value for a given offset.
public offsetUnset ( mixed $offset ) : void
$offset mixed
Результат void

reguard() публичный статический Метод

Enable the mass assignment restrictions.
public static reguard ( ) : void
Результат void

replicate() публичный Метод

Clone the model into a new, non-existing instance.
public replicate ( array $except = null ) : Model
$except array
Результат Model

setAppends() публичный Метод

Set the accessors to append to model arrays.
public setAppends ( array $appends )
$appends array

setAttribute() публичный Метод

Set a given attribute on the model.
public setAttribute ( string $key, mixed $value )
$key string
$value mixed

setHidden() публичный Метод

Set the hidden attributes for the model.
public setHidden ( array $hidden )
$hidden array

setVisible() публичный Метод

Set the visible attributes for the model.
public setVisible ( array $visible )
$visible array

toArray() публичный Метод

Convert the model instance to an array.
public toArray ( ) : array
Результат array

toJson() публичный Метод

Convert the model instance to JSON.
public toJson ( integer $options ) : string
$options integer
Результат string

totallyGuarded() публичный Метод

Determine if the model is totally guarded.
public totallyGuarded ( ) : boolean
Результат boolean

unguard() публичный статический Метод

Disable all mass assignable restrictions.
public static unguard ( boolean $state = true ) : void
$state boolean
Результат void

unguarded() публичный статический Метод

Run the given callable while being unguarded.
public static unguarded ( callable $callback ) : mixed
$callback callable
Результат mixed

withHidden() публичный Метод

Make the given, typically hidden, attributes visible.
public withHidden ( array | string $attributes )
$attributes array | string

Описание свойств

$appends защищенное свойство

The accessors to append to the model's array form.
protected array $appends
Результат array

$attributes защищенное свойство

The model's attributes.
protected array $attributes
Результат array

$casts защищенное свойство

The attributes that should be casted to native types.
protected array $casts
Результат array

$fillable защищенное свойство

The attributes that are mass assignable.
protected array $fillable
Результат array

$guarded защищенное свойство

The attributes that aren't mass assignable.
protected array $guarded
Результат array

$hidden защищенное свойство

The attributes that should be hidden for arrays.
protected array $hidden
Результат array

$mutatorCache защищенное статическое свойство

The cache of the mutated attributes for each class.
protected static array $mutatorCache
Результат array

$snakeAttributes публичное статическое свойство

Indicates whether attributes are snake cased on arrays.
public static bool $snakeAttributes
Результат boolean

$unguarded защищенное статическое свойство

Indicates if all mass assignment is enabled.
protected static bool $unguarded
Результат boolean

$visible защищенное свойство

The attributes that should be visible in arrays.
protected array $visible
Результат array