PHP Trait Eloquent\Dialect\Json

Afficher le fichier Open project: darrylkuhn/dialect

Méthodes publiques

Свойство Type Description
$jsonOperators array test_column->>'value').

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
mutateAttribute ( string $key, mixed $value ) : mixed Check if the key is a known json attribute and return that value.

Method Details

addHintedAttributes() public méthode

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

flagJsonAttribute() public méthode

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() public méthode

Add json attributes to the list of things that have changed (when they've changed).
public getDirty ( $includeJson = false ) : array
Résultat array

getMutatedAttributes() public méthode

Include the JSON attributes in the list of mutated attributes for a given instance.
public getMutatedAttributes ( ) : array
Résultat array

hasGetMutator() public méthode

Include JSON column in the list of attributes that have a get mutator.
public hasGetMutator ( string $key ) : boolean
$key string
Résultat boolean

hintJsonStructure() public méthode

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() public méthode

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

mutateAttribute() protected méthode

Check if the key is a known json attribute and return that value.
protected mutateAttribute ( string $key, mixed $value ) : mixed
$key string
$value mixed
Résultat mixed

newFromBuilder() public méthode

Overrides parent to set Json columns.
public newFromBuilder ( array $attributes = [], string | null $connection = null ) : static
$attributes array
$connection string | null
Résultat static

setAttribute() public méthode

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

setJsonAttribute() public méthode

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

showJsonAttributes() public méthode

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
Résultat boolean

showJsonColumns() public méthode

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
Résultat boolean

Property Details

$jsonOperators public_oe static_oe property

test_column->>'value').
public static array $jsonOperators
Résultat array