PHP 클래스 Jenssegers\Model\Model

상속: implements ArrayAcces\ArrayAccess, implements Illuminate\Contracts\Support\Arrayable, implements Illuminate\Contracts\Support\Jsonable, implements JsonSerializabl\JsonSerializable
파일 보기 프로젝트 열기: jenssegers/model 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$snakeAttributes boolean Indicates whether attributes are snake cased on arrays.

보호된 프로퍼티들

프로퍼티 타입 설명
$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