PHP Трейт Eloquent\Dialect\Json

Показать файл Открыть проект

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

Свойство Тип Описание
$jsonOperators array test_column->>'value').

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

Метод Описание
addHintedAttributes ( ) Schema free data architecture give us tons of flexibility (yay) but makes it hard to inspect a structure and build getters/setters.
flagJsonAttribute ( string $key, string $col ) Record that a given JSON element is found on a particular column.
getDirty ( $includeJson = false ) : array Add json attributes to the list of things that have changed (when they've changed).
getMutatedAttributes ( ) : array Include the JSON attributes in the list of mutated attributes for a given instance.
hasGetMutator ( string $key ) : boolean Include JSON column in the list of attributes that have a get mutator.
hintJsonStructure ( string $column, string $structure ) Sets a hint for a given column.
inspectJsonColumns ( ) Decodes each of the declared JSON attributes and records the attributes on each.
newFromBuilder ( array $attributes = [], string | null $connection = null ) : static Create a new model instance that is existing.
setAttribute ( string $key, mixed $value ) Set a given attribute on the known JSON elements.
setJsonAttribute ( string $attribute, string $key, mixed $value ) Set a given attribute on the known JSON elements.
showJsonAttributes ( $show ) : boolean Allows you to specify if the attributes within various json columns should be shown on toArray() and toJson() calls. Set this value in the models constructor (to make sure it is set before newFromBuilder() is called). This is true by default.
showJsonColumns ( boolean $show ) : boolean Allows you to specify if the actual JSON column housing the attributes should be shown on toArray() and toJson() calls. Set this value in the models constructor (to make sure it is set before newFromBuilder() is called). This is false by default.

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

Метод Описание
mutateAttribute ( string $key, mixed $value ) : mixed Check if the key is a known json attribute and return that value.

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

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

Therefore you can "hint" the structure to make life easier.
public addHintedAttributes ( )

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

Record that a given JSON element is found on a particular column.
public flagJsonAttribute ( string $key, string $col )
$key string attribute name within the JSON column
$col string name of JSON column

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

Add json attributes to the list of things that have changed (when they've changed).
public getDirty ( $includeJson = false ) : array
Результат array

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

Include the JSON attributes in the list of mutated attributes for a given instance.
public getMutatedAttributes ( ) : array
Результат array

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

Include JSON column in the list of attributes that have a get mutator.
public hasGetMutator ( string $key ) : boolean
$key string
Результат boolean

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

Sets a hint for a given column.
public hintJsonStructure ( string $column, string $structure )
$column string name of column that we're hinting
$structure string json encoded structure

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

Decodes each of the declared JSON attributes and records the attributes on each.
public inspectJsonColumns ( )

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

Check if the key is a known json attribute and return that value.
protected mutateAttribute ( string $key, mixed $value ) : mixed
$key string
$value mixed
Результат mixed

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

Overrides parent to set Json columns.
public newFromBuilder ( array $attributes = [], string | null $connection = null ) : static
$attributes array
$connection string | null
Результат static

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

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

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

Set a given attribute on the known JSON elements.
public setJsonAttribute ( string $attribute, string $key, mixed $value )
$attribute string
$key string
$value mixed

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

Allows you to specify if the attributes within various json columns should be shown on toArray() and toJson() calls. Set this value in the models constructor (to make sure it is set before newFromBuilder() is called). This is true by default.
public showJsonAttributes ( $show ) : boolean
Результат boolean

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

Allows you to specify if the actual JSON column housing the attributes should be shown on toArray() and toJson() calls. Set this value in the models constructor (to make sure it is set before newFromBuilder() is called). This is false by default.
public showJsonColumns ( boolean $show ) : boolean
$show boolean
Результат boolean

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

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

test_column->>'value').
public static array $jsonOperators
Результат array