class Layout extends Model

Layout Template Class

Traits

Adds event related features to any class.

Extendable Trait Allows for "Private traits"

Properties

protected array $extensionData from  ExtendableTrait
static protected array $extendableCallbacks from  ExtendableTrait
static protected array $extendableStaticMethods from  ExtendableTrait
static protected bool $extendableGuardProperties from  ExtendableTrait
static protected ClassLoader $extendableClassLoader from  ExtendableTrait
$implement from  Extendable
protected array $hidden

The attributes that should be hidden for serialization.

from  HidesAttributes
protected array $visible

The attributes that should be visible in serialization.

from  HidesAttributes
array $attributes

The model's attributes.

from  HasAttributes
protected array $original

The model attribute's original state.

from  HasAttributes
protected array $changes

The changed model attributes.

from  HasAttributes
static bool $snakeAttributes

Indicates whether attributes are snake cased on arrays.

from  HasAttributes
static protected array $mutatorCache

The cache of the mutated attributes for each class.

from  HasAttributes
protected array $fillable

The attributes that are mass assignable.

from  GuardsAttributes
protected array $dispatchesEvents

The event map for the model.

from  HasEvents
protected array $observables

User exposed observable events.

from  HasEvents
static protected CacheManager $cache

The cache manager instance.

from  ManagesCache
protected bool $loadedFromCache from  ManagesCache
protected array $emitterSingleEvents from  EventEmitter
protected array $emitterEvents from  EventEmitter
protected array $emitterEventSorted from  EventEmitter
static protected SourceResolverInterface $resolver

The source resolver instance.

from  Model
static $dispatcher from  Model
static protected array $booted

The array of booted models.

from  Model
static protected array $eventsBooted

The array of booted events.

from  Model
protected $source from  Model
protected string $dirName
protected array $appends

The accessors to append to the model's array form.

from  Model
protected array $purgeable from  Model
bool $exists

Indicates if the model exists.

from  Model
protected array $allowedExtensions from  Model
protected string $defaultExtension from  Model
protected int $maxNesting from  Model
BaseComponent[] $components from  HasComponents
array $viewBag from  HasViewBag
protected mixed $viewBagCache from  HasViewBag
protected Theme $themeCache from  Model
$settings from  Model
$controller

Methods

extendableConstruct()

Constructor.

static void
extendableExtendCallback(callable $callback)

Helper method for ::extend() static method

static void
clearExtendedClasses()

Clear the list of extended classes so they will be re-extended.

string
extensionNormalizeClassName(string $name)

Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes

extendClassWith(string $extensionName)

Dynamically extend a class with a specified behavior

void
extensionExtractMethods(string $extensionName, object $extensionObject)

Extracts the available methods from a behavior and adds it to the list of callable methods.

addDynamicMethod(string $dynamicName, callable $method, string $extension = null)

Programmatically adds a method to the extendable class

addDynamicProperty(string $dynamicName, string $value = null)

Programatically adds a property to the extendable class

bool
isClassExtendedWith(string $name)

Check if extendable class is extended with a behavior object

mixed
getClassExtension(string $name)

Returns a behavior object from an extendable class, example:

mixed
asExtension(string $shortName)

Short hand for getClassExtension() method, except takes the short extension name, example:

bool
methodExists(string $name)

Checks if a method exists, extension equivalent of method_exists()

array
getClassMethods()

Get a list of class methods, extension equivalent of get_class_methods()

array
getDynamicProperties()

Returns all dynamic properties and their values

bool
propertyExists(string $name)

Checks if a property exists, extension equivalent of property_exists()

bool
extendableIsAccessible(mixed $class, string $propertyName)

Checks if a property is accessible, property equivalent of is_callabe()

string
extendableGet(string $name)

Magic method for __get()

string
extendableSet(string $name, string $value)

Magic method for __set()

mixed
extendableCall(string $name, array $params = null)

Magic method for __call()

static mixed
extendableCallStatic(string $name, array $params = null)

Magic method for __callStatic()

ClassLoader|null
extensionGetClassLoader()

Gets the class loader

__construct(array $attributes = [])

Create a new Halcyon model instance.

from  Model
__get($name)

Implements getter functionality for visible properties defined in the settings section or view bag array.

from  Model
__set(string $key, $value)

Dynamically set attributes on the model.

from  Model
__call(string $method, array $parameters)

Handle dynamic method calls into the model.

from  Model
static 
__callStatic(string $method, array $parameters)

Handle dynamic static method calls into the method.

from  Model
static 
extend(callable $callback)

No description

array
getHidden()

Get the hidden attributes for the model.

$this
setHidden(array $hidden)

Set the hidden attributes for the model.

void
addHidden(array|string|null $attributes = null)

Add hidden attributes for the model.

array
getVisible()

Get the visible attributes for the model.

$this
setVisible(array $visible)

Set the visible attributes for the model.

void
addVisible(array|string|null $attributes = null)

Add visible attributes for the model.

$this
makeVisible(array|string $attributes)

Make the given, typically hidden, attributes visible.

$this
makeHidden(array|string $attributes)

Make the given, typically visible, attributes hidden.

array
attributesToArray()

Convert the model's attributes to an array.

array
addMutatedAttributesToArray(array $attributes, array $mutatedAttributes)

Add the mutated attributes to the attributes array.

array
getArrayableAttributes()

Get an attribute array of all arrayable attributes.

array
getArrayableAppends()

Get all of the appendable values that are arrayable.

array
getArrayableItems(array $values)

Get an attribute array of all arrayable values.

mixed
getAttribute(string $key)

Get an attribute from the model.

mixed
getAttributeValue(string $key)

Get a plain attribute (not a relationship).

mixed
getAttributeFromArray(string $key)

Get an attribute from the $attributes array.

bool
hasGetMutator(string $key)

Determine if a get mutator exists for an attribute.

mixed
mutateAttribute(string $key, mixed $value)

Get the value of an attribute using its mutator.

mixed
mutateAttributeForArray(string $key, mixed $value)

Get the value of an attribute using its mutator for array conversion.

$this
setAttribute(string $key, mixed $value)

Set a given attribute on the model.

bool
hasSetMutator(string $key)

Determine if a set mutator exists for an attribute.

array
getAttributes()

Get all of the current attributes on the model.

$this
setRawAttributes(array $attributes, bool $sync = false)

Set the array of model attributes. No checking is done.

mixed|array
getOriginal(string|null $key = null, mixed $default = null)

Get the model's original attribute values.

array
only(array|mixed $attributes)

Get a subset of the model's attributes.

$this
syncOriginal()

Sync the original attributes with the current.

$this
syncOriginalAttribute(string $attribute)

Sync a single original attribute with its current value.

$this
syncChanges()

Sync the changed attributes.

bool
isDirty(array|string|null $attributes = null)

Determine if the model or given attribute(s) have been modified.

bool
isClean(array|string|null $attributes = null)

Determine if the model or given attribute(s) have remained the same.

bool
wasChanged(array|string|null $attributes = null)

Determine if the model or given attribute(s) have been modified.

bool
hasChanges(array $changes, array|string|null $attributes = null)

Determine if the given attributes were changed.

array
getDirty()

Get the attributes that have been changed since last sync.

array
getChanges()

Get the attributes that was changed.

bool
originalIsEquivalent(string $key, mixed $current)

Determine if the new and old values for a given key are equivalent.

array
getMutatedAttributes()

Get the mutated attributes for a given instance.

static void
cacheMutatedAttributes(string $class)

Extract and cache all the mutated attributes of a class.

static array
getMutatorMethods(mixed $class)

Get all of the attribute mutator methods.

array
getFillable()

Get the fillable attributes for the model.

$this
fillable(array $fillable)

Set the fillable attributes for the model.

array
fillableFromArray(array $attributes)

Get the fillable attributes of a given array.

bool
isFillable(string $key)

Determine if the given attribute may be mass assigned.

static void
observe(object|string $class)

Register an observer with the Model.

array
getObservableEvents()

Get the observable event names.

$this
setObservableEvents(array $observables)

Set the observable event names.

void
addObservableEvents(array|mixed $observables)

Add an observable event name.

void
removeObservableEvents(array|mixed $observables)

Remove an observable event name.

static void
registerModelEvent(string $event, Closure|string $callback, int $priority = 0)

Register a model event with the dispatcher.

bootNicerEvents()

Bind some nicer events to this model, in the format of method overrides.

mixed
fireModelEvent(string $event, bool $halt = true)

Fire the given event for the model.

mixed|null
fireCustomModelEvent(string $event, string $method)

Fire a custom model event for the given event.

mixed
filterModelEventResults(mixed $result)

Filter the model event results.

static void
retrieving(Closure|string $callback)

Create a new native event for handling beforeFetch().

static void
retrieved(Closure|string $callback)

Register a retrieved model event with the dispatcher.

static void
saving(Closure|string $callback, int $priority = 0)

Register a saving model event with the dispatcher.

static void
saved(Closure|string $callback, int $priority = 0)

Register a saved model event with the dispatcher.

static void
updating(Closure|string $callback, int $priority = 0)

Register an updating model event with the dispatcher.

static void
updated(Closure|string $callback, int $priority = 0)

Register an updated model event with the dispatcher.

static void
creating(Closure|string $callback, int $priority = 0)

Register a creating model event with the dispatcher.

static void
created(Closure|string $callback, int $priority = 0)

Register a created model event with the dispatcher.

static void
deleting(Closure|string $callback, int $priority = 0)

Register a deleting model event with the dispatcher.

static void
deleted(Closure|string $callback, int $priority = 0)

Register a deleted model event with the dispatcher.

static void
flushEventListeners()

Remove all of the event listeners for the model.

static Dispatcher
getEventDispatcher()

Get the event dispatcher instance.

static void
setEventDispatcher(Dispatcher $dispatcher)

Set the event dispatcher instance.

static void
unsetEventDispatcher()

Unset the event dispatcher for models.

static CacheManager
getCacheManager()

Get the cache manager instance.

static void
setCacheManager(CacheManager $cache)

Set the cache manager instance.

static void
unsetCacheManager()

Unset the cache manager for models.

static 
initCacheItem($item)

Initializes the object properties from the cached data. The extra data set here becomes available as attributes set on the model after fetch.

bool
isLoadedFromCache()

Returns true if the object was loaded from the cache.

void
setLoadedFromCache($value)

Returns true if the object was loaded from the cache.

bindEvent(string $event, callable $callback, int $priority = 0)

Create a new event binding.

bindEventOnce(string $event, callable $callback)

Create a new event binding that fires once only

void
emitterEventSortEvents(string $eventName)

Sort the listeners for a given event by priority.

unbindEvent(string $event = null)

Destroys an event binding.

string|array
fireEvent(string $event, array $params = [], bool $halt = false)

Fire an event and call the listeners.

mixed
fireSystemEvent(string $event, array $params = [], bool $halt = true)

Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.

void
bootIfNotBooted()

Check if the model needs to be booted and if so, do it.

from  Model
static void
boot()

The "booting" method of the model.

from  Model
static void
bootTraits()

Boot all of the bootable traits on the model.

from  Model
static void
clearBootedModels()

Clear the list of booted models so they will be re-booted.

from  Model
static Model|Finder
on($source)

No description

from  Model
static SourceInterface
resolveSource(string|null $source = null)

No description

from  Model
getSourceResolver()

Get the source resolver instance.

from  Model
static void
setSourceResolver(SourceResolverInterface $resolver)

Set the source resolver instance.

from  Model
static void
unsetSourceResolver()

Unset the source resolver for models.

from  Model
static Collection
hydrate(array $items, string|null $source = null)

Create a collection of models from plain arrays.

from  Model
static Model
create(array $attributes = [])

Save a new model and return the instance.

from  Model
static Finder
query()

Begin querying the model.

from  Model
static Collection|Model[]
all()

Get all of the models from the source.

from  Model
$this
fill(array $attributes)

Fill the model with an array of attributes.

from  Model
getSource()

No description

from  Model
setSource($source)

No description

from  Model
string
getSourceName()

Get the current source name for the model.

from  Model
string
getBaseFileNameAttribute()

Returns the file name without the extension.

from  Model
array
getSettingsAttribute()

The settings is attribute contains everything that should be saved to the settings area.

from  Model
setSettingsAttribute(mixed $value)

Filling the settings should merge it with attributes.

from  Model
setFileNameAttribute(mixed $value)

File name should always contain an extension.

from  Model
string
getTypeDirName()

Returns the directory name corresponding to the object type.

from  Model
array
getAllowedExtensions()

Returns the allowable file extensions supported by this model.

from  Model
int
getMaxNesting()

Returns the maximum directory nesting allowed by this template.

from  Model
array
getFileNameParts(string $fileName = null)

Returns the base file name and extension. Applies a default extension, if none found.

from  Model
newFinder()

Get a new file finder for the object

from  Model
Collection
newCollection(array $models = [])

Create a new Collection instance.

from  Model
newInstance(array $attributes = [], bool $exists = false)

Create a new instance of the given model.

from  Model
newFromFinder(array $attributes = [], string|null $source = null)

Create a new model instance that is existing.

from  Model
bool|int
update(array $attributes = [])

Update the model in the database.

from  Model
bool
save(array $options = [])

Save the model to the source.

from  Model
bool
saveInternal(array $options = [])

Save the model to the database. Is used by save()} and {@link forceSave().

from  Model
void
finishSave(array $options)

Finish processing on a successful save operation.

from  Model
bool
performUpdate(Finder $query, array $options = [])

Perform a model update operation.

from  Model
bool
performInsert(Finder $query, array $options = [])

Perform a model insert operation.

from  Model
bool|null
delete()

Delete the model from the database.

from  Model
void
performDeleteOnModel()

Perform the actual delete query on this model instance.

from  Model
string
__toString()

Convert the model to its string representation.

from  Model
bool
__isset(string $key)

Determine if an attribute exists on the object.

from  Model
void
__unset(string $key)

Unset an attribute on the model.

from  Model
bool
offsetExists(mixed $offset)

Determine if the given attribute exists.

from  Model
mixed
offsetGet(mixed $offset)

Get the value for a given offset.

from  Model
void
offsetSet(mixed $offset, mixed $value)

Set the value for a given offset.

from  Model
void
offsetUnset(mixed $offset)

Unset the value for a given offset.

from  Model
array
toArray()

Get the instance as an array.

from  Model
string
toJson(int $options = 0)

Convert the model instance to JSON.

from  Model
array
jsonSerialize()

Convert the object into something JSON serializable.

from  Model
static void
bootHasComponents()

Boot the sortable trait for this model.

parseComponentSettings()

No description

getComponent(string $componentName)

Returns a component by its name.

mixed
hasComponent(string $componentName)

Checks if the object has a component with the specified name.

runComponents()

No description

updateComponent($alias, array $properties)

No description

static void
bootHasViewBag()

Boot the sortable trait for this model.

parseSettings()

No description

getViewBag()

Returns the configured view bag component.

void
fillViewBagArray()

Copies view bag properties to the view bag array.

static void
bootDefaultTheme()

Boot all of the bootable traits on the model.

from  Model
static mixed
load(Theme $theme, string $fileName)

Loads the object from a file.

from  Model
static mixed
loadCached(Theme $theme, string $fileName)

Loads the object from a cache.

from  Model
static array|Collection
listInTheme(Theme $theme, bool $skipCache = false)

Returns the list of objects in the specified theme.

from  Model
static 
inTheme(Theme $theme)

No description

from  Model
static 
getDropdownOptions(Theme $theme = null, $skipCache = false)

No description

from  Model
string
getId()

Returns the unique id of this object.

from  Model
getThemeAttribute($value = null)

Returns the theme this object belongs to.

from  Model
string
getFilePath(string $fileName = null)

Returns the local file path to the template.

from  Model
string
getFileName()

Returns the file name.

from  Model
string
getBaseFileName()

Returns the file name without the extension.

from  Model
string
getContent()

Returns the file content.

from  Model
string
getMarkup()

Gets the markup section of a template

from  Model
string
getCode()

Gets the code section of a template

from  Model
string
getTemplateCacheKey()

Returns the key used by the Template cache.

from  Model
static 
initFallback($theme)

No description

mixed
getCodeClassParent()

Returns name of a PHP class to use as parent for the PHP class created for the template's PHP section.

Details

in ExtendableTrait at line 55
extendableConstruct()

Constructor.

in ExtendableTrait at line 103
static void extendableExtendCallback(callable $callback)

Helper method for ::extend() static method

Parameters

callable $callback

Return Value

void

in ExtendableTrait at line 120
static void clearExtendedClasses()

Clear the list of extended classes so they will be re-extended.

Return Value

void

in ExtendableTrait at line 131
protected string extensionNormalizeClassName(string $name)

Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes

Parameters

string $name

Return Value

string

in ExtendableTrait at line 149
void|ExtendableTrait extendClassWith(string $extensionName)

Dynamically extend a class with a specified behavior

Parameters

string $extensionName

Return Value

void|ExtendableTrait

Exceptions

Exception

in ExtendableTrait at line 178
protected void extensionExtractMethods(string $extensionName, object $extensionObject)

Extracts the available methods from a behavior and adds it to the list of callable methods.

Parameters

string $extensionName
object $extensionObject

Return Value

void

in ExtendableTrait at line 206
addDynamicMethod(string $dynamicName, callable $method, string $extension = null)

Programmatically adds a method to the extendable class

Parameters

string $dynamicName
callable $method
string $extension

in ExtendableTrait at line 225
addDynamicProperty(string $dynamicName, string $value = null)

Programatically adds a property to the extendable class

Parameters

string $dynamicName
string $value

in ExtendableTrait at line 249
bool isClassExtendedWith(string $name)

Check if extendable class is extended with a behavior object

Parameters

string $name

Fully qualified behavior name

Return Value

bool

in ExtendableTrait at line 265
mixed getClassExtension(string $name)

Returns a behavior object from an extendable class, example:

$this->getClassExtension('Admin.Actions.FormController')

Parameters

string $name

Fully qualified behavior name

Return Value

mixed

in ExtendableTrait at line 280
mixed asExtension(string $shortName)

Short hand for getClassExtension() method, except takes the short extension name, example:

$this->asExtension('FormController')

Parameters

string $shortName

Return Value

mixed

in ExtendableTrait at line 301
bool methodExists(string $name)

Checks if a method exists, extension equivalent of method_exists()

Parameters

string $name

Return Value

bool

in ExtendableTrait at line 313
array getClassMethods()

Get a list of class methods, extension equivalent of get_class_methods()

Return Value

array

in ExtendableTrait at line 326
array getDynamicProperties()

Returns all dynamic properties and their values

Return Value

array

['property' => 'value']

in ExtendableTrait at line 344
bool propertyExists(string $name)

Checks if a property exists, extension equivalent of property_exists()

Parameters

string $name

Return Value

bool

in ExtendableTrait at line 370
protected bool extendableIsAccessible(mixed $class, string $propertyName)

Checks if a property is accessible, property equivalent of is_callabe()

Parameters

mixed $class
string $propertyName

Return Value

bool

in ExtendableTrait at line 385
string extendableGet(string $name)

Magic method for __get()

Parameters

string $name

Return Value

string

in ExtendableTrait at line 410
string extendableSet(string $name, string $value)

Magic method for __set()

Parameters

string $name
string $value

Return Value

string

in ExtendableTrait at line 444
mixed extendableCall(string $name, array $params = null)

Magic method for __call()

Parameters

string $name
array $params

Return Value

mixed

in ExtendableTrait at line 483
static mixed extendableCallStatic(string $name, array $params = null)

Magic method for __callStatic()

Parameters

string $name
array $params

Return Value

mixed

in ExtendableTrait at line 552
protected ClassLoader|null extensionGetClassLoader()

Gets the class loader

Return Value

ClassLoader|null

in Model at line 98
__construct(array $attributes = [])

Create a new Halcyon model instance.

Parameters

array $attributes

in Model at line 260
__get($name)

Implements getter functionality for visible properties defined in the settings section or view bag array.

Parameters

$name

in Model at line 276
__set(string $key, $value)

Dynamically set attributes on the model.

Parameters

string $key
$value

in Model at line 738
__call(string $method, array $parameters)

Handle dynamic method calls into the model.

Parameters

string $method
array $parameters

in Model at line 758
static __callStatic(string $method, array $parameters)

Handle dynamic static method calls into the method.

Parameters

string $method
array $parameters

in Extendable at line 50
static extend(callable $callback)

No description

Parameters

callable $callback

in HidesAttributes at line 26
array getHidden()

Get the hidden attributes for the model.

Return Value

array

in HidesAttributes at line 38
$this setHidden(array $hidden)

Set the hidden attributes for the model.

Parameters

array $hidden

Return Value

$this

in HidesAttributes at line 52
void addHidden(array|string|null $attributes = null)

Add hidden attributes for the model.

Parameters

array|string|null $attributes

Return Value

void

in HidesAttributes at line 64
array getVisible()

Get the visible attributes for the model.

Return Value

array

in HidesAttributes at line 76
$this setVisible(array $visible)

Set the visible attributes for the model.

Parameters

array $visible

Return Value

$this

in HidesAttributes at line 90
void addVisible(array|string|null $attributes = null)

Add visible attributes for the model.

Parameters

array|string|null $attributes

Return Value

void

in HidesAttributes at line 104
$this makeVisible(array|string $attributes)

Make the given, typically hidden, attributes visible.

Parameters

array|string $attributes

Return Value

$this

in HidesAttributes at line 122
$this makeHidden(array|string $attributes)

Make the given, typically visible, attributes hidden.

Parameters

array|string $attributes

Return Value

$this

in HasAttributes at line 51
array attributesToArray()

Convert the model's attributes to an array.

Return Value

array

in HasAttributes at line 77
protected array addMutatedAttributesToArray(array $attributes, array $mutatedAttributes)

Add the mutated attributes to the attributes array.

Parameters

array $attributes
array $mutatedAttributes

Return Value

array

in HasAttributes at line 103
protected array getArrayableAttributes()

Get an attribute array of all arrayable attributes.

Return Value

array

in HasAttributes at line 113
protected array getArrayableAppends()

Get all of the appendable values that are arrayable.

Return Value

array

in HasAttributes at line 131
protected array getArrayableItems(array $values)

Get an attribute array of all arrayable values.

Parameters

array $values

Return Value

array

in HasAttributes at line 151
mixed getAttribute(string $key)

Get an attribute from the model.

Parameters

string $key

Return Value

mixed

in HasAttributes at line 187
mixed getAttributeValue(string $key)

Get a plain attribute (not a relationship).

Parameters

string $key

Return Value

mixed

in HasAttributes at line 208
protected mixed getAttributeFromArray(string $key)

Get an attribute from the $attributes array.

Parameters

string $key

Return Value

mixed

in HasAttributes at line 222
bool hasGetMutator(string $key)

Determine if a get mutator exists for an attribute.

Parameters

string $key

Return Value

bool

in HasAttributes at line 235
protected mixed mutateAttribute(string $key, mixed $value)

Get the value of an attribute using its mutator.

Parameters

string $key
mixed $value

Return Value

mixed

in HasAttributes at line 248
protected mixed mutateAttributeForArray(string $key, mixed $value)

Get the value of an attribute using its mutator for array conversion.

Parameters

string $key
mixed $value

Return Value

mixed

in HasAttributes at line 263
$this setAttribute(string $key, mixed $value)

Set a given attribute on the model.

Parameters

string $key
mixed $value

Return Value

$this

in HasAttributes at line 286
bool hasSetMutator(string $key)

Determine if a set mutator exists for an attribute.

Parameters

string $key

Return Value

bool

in HasAttributes at line 296
array getAttributes()

Get all of the current attributes on the model.

Return Value

array

in HasAttributes at line 309
$this setRawAttributes(array $attributes, bool $sync = false)

Set the array of model attributes. No checking is done.

Parameters

array $attributes
bool $sync

Return Value

$this

in HasAttributes at line 328
mixed|array getOriginal(string|null $key = null, mixed $default = null)

Get the model's original attribute values.

Parameters

string|null $key
mixed $default

Return Value

mixed|array

in HasAttributes at line 340
array only(array|mixed $attributes)

Get a subset of the model's attributes.

Parameters

array|mixed $attributes

Return Value

array

in HasAttributes at line 356
$this syncOriginal()

Sync the original attributes with the current.

Return Value

$this

in HasAttributes at line 370
$this syncOriginalAttribute(string $attribute)

Sync a single original attribute with its current value.

Parameters

string $attribute

Return Value

$this

in HasAttributes at line 382
$this syncChanges()

Sync the changed attributes.

Return Value

$this

in HasAttributes at line 396
bool isDirty(array|string|null $attributes = null)

Determine if the model or given attribute(s) have been modified.

Parameters

array|string|null $attributes

Return Value

bool

in HasAttributes at line 410
bool isClean(array|string|null $attributes = null)

Determine if the model or given attribute(s) have remained the same.

Parameters

array|string|null $attributes

Return Value

bool

in HasAttributes at line 422
bool wasChanged(array|string|null $attributes = null)

Determine if the model or given attribute(s) have been modified.

Parameters

array|string|null $attributes

Return Value

bool

in HasAttributes at line 437
protected bool hasChanges(array $changes, array|string|null $attributes = null)

Determine if the given attributes were changed.

Parameters

array $changes
array|string|null $attributes

Return Value

bool

in HasAttributes at line 463
array getDirty()

Get the attributes that have been changed since last sync.

Return Value

array

in HasAttributes at line 481
array getChanges()

Get the attributes that was changed.

Return Value

array

in HasAttributes at line 494
protected bool originalIsEquivalent(string $key, mixed $current)

Determine if the new and old values for a given key are equivalent.

Parameters

string $key
mixed $current

Return Value

bool

in HasAttributes at line 518
array getMutatedAttributes()

Get the mutated attributes for a given instance.

Return Value

array

in HasAttributes at line 536
static void cacheMutatedAttributes(string $class)

Extract and cache all the mutated attributes of a class.

Parameters

string $class

Return Value

void

in HasAttributes at line 550
static protected array getMutatorMethods(mixed $class)

Get all of the attribute mutator methods.

Parameters

mixed $class

Return Value

array

in GuardsAttributes at line 21
array getFillable()

Get the fillable attributes for the model.

Return Value

array

in GuardsAttributes at line 33
$this fillable(array $fillable)

Set the fillable attributes for the model.

Parameters

array $fillable

Return Value

$this

in GuardsAttributes at line 47
protected array fillableFromArray(array $attributes)

Get the fillable attributes of a given array.

Parameters

array $attributes

Return Value

array

in GuardsAttributes at line 65
bool isFillable(string $key)

Determine if the given attribute may be mass assigned.

Parameters

string $key

Return Value

bool

in HasEvents at line 34
static void observe(object|string $class)

Register an observer with the Model.

Parameters

object|string $class

Return Value

void

in HasEvents at line 55
array getObservableEvents()

Get the observable event names.

Return Value

array

in HasEvents at line 74
$this setObservableEvents(array $observables)

Set the observable event names.

Parameters

array $observables

Return Value

$this

in HasEvents at line 88
void addObservableEvents(array|mixed $observables)

Add an observable event name.

Parameters

array|mixed $observables

Return Value

void

in HasEvents at line 102
void removeObservableEvents(array|mixed $observables)

Remove an observable event name.

Parameters

array|mixed $observables

Return Value

void

in HasEvents at line 118
static protected void registerModelEvent(string $event, Closure|string $callback, int $priority = 0)

Register a model event with the dispatcher.

Parameters

string $event
Closure|string $callback
int $priority

Return Value

void

in HasEvents at line 130
protected bootNicerEvents()

Bind some nicer events to this model, in the format of method overrides.

in HasEvents at line 177
protected mixed fireModelEvent(string $event, bool $halt = true)

Fire the given event for the model.

Parameters

string $event
bool $halt

Return Value

mixed

in HasEvents at line 209
protected mixed|null fireCustomModelEvent(string $event, string $method)

Fire a custom model event for the given event.

Parameters

string $event
string $method

Return Value

mixed|null

in HasEvents at line 229
protected mixed filterModelEventResults(mixed $result)

Filter the model event results.

Parameters

mixed $result

Return Value

mixed

in HasEvents at line 247
static void retrieving(Closure|string $callback)

Create a new native event for handling beforeFetch().

Parameters

Closure|string $callback

Return Value

void

in HasEvents at line 259
static void retrieved(Closure|string $callback)

Register a retrieved model event with the dispatcher.

Parameters

Closure|string $callback

Return Value

void

in HasEvents at line 272
static void saving(Closure|string $callback, int $priority = 0)

Register a saving model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in HasEvents at line 285
static void saved(Closure|string $callback, int $priority = 0)

Register a saved model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in HasEvents at line 298
static void updating(Closure|string $callback, int $priority = 0)

Register an updating model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in HasEvents at line 311
static void updated(Closure|string $callback, int $priority = 0)

Register an updated model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in HasEvents at line 324
static void creating(Closure|string $callback, int $priority = 0)

Register a creating model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in HasEvents at line 337
static void created(Closure|string $callback, int $priority = 0)

Register a created model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in HasEvents at line 350
static void deleting(Closure|string $callback, int $priority = 0)

Register a deleting model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in HasEvents at line 363
static void deleted(Closure|string $callback, int $priority = 0)

Register a deleted model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in HasEvents at line 373
static void flushEventListeners()

Remove all of the event listeners for the model.

Return Value

void

in HasEvents at line 391
static Dispatcher getEventDispatcher()

Get the event dispatcher instance.

Return Value

Dispatcher

in HasEvents at line 403
static void setEventDispatcher(Dispatcher $dispatcher)

Set the event dispatcher instance.

Parameters

Dispatcher $dispatcher

Return Value

void

in HasEvents at line 413
static void unsetEventDispatcher()

Unset the event dispatcher for models.

Return Value

void

in ManagesCache at line 22
static CacheManager getCacheManager()

Get the cache manager instance.

Return Value

CacheManager

in ManagesCache at line 34
static void setCacheManager(CacheManager $cache)

Set the cache manager instance.

Parameters

CacheManager $cache

Return Value

void

in ManagesCache at line 43
static void unsetCacheManager()

Unset the cache manager for models.

Return Value

void

in ManagesCache at line 54
static initCacheItem($item)

Initializes the object properties from the cached data. The extra data set here becomes available as attributes set on the model after fetch.

Parameters

$item

in ManagesCache at line 62
bool isLoadedFromCache()

Returns true if the object was loaded from the cache.

Return Value

bool

in ManagesCache at line 74
void setLoadedFromCache($value)

Returns true if the object was loaded from the cache.

Parameters

$value

Return Value

void

in EventEmitter at line 36
EventEmitter bindEvent(string $event, callable $callback, int $priority = 0)

Create a new event binding.

Parameters

string $event

The event name to listen for

callable $callback

The callback to call when emitted

int $priority

Return Value

EventEmitter

in EventEmitter at line 52
EventEmitter bindEventOnce(string $event, callable $callback)

Create a new event binding that fires once only

Parameters

string $event

The event name

callable $callback

Return Value

EventEmitter

in EventEmitter at line 66
protected void emitterEventSortEvents(string $eventName)

Sort the listeners for a given event by priority.

Parameters

string $eventName

Return Value

void

in EventEmitter at line 84
EventEmitter unbindEvent(string $event = null)

Destroys an event binding.

Parameters

string $event

Event to destroy

Return Value

EventEmitter

in EventEmitter at line 124
string|array fireEvent(string $event, array $params = [], bool $halt = false)

Fire an event and call the listeners.

Parameters

string $event

Event name

array $params

Event parameters

bool $halt

Halt after first non-null result

Return Value

string|array

Collection of event results / Or single result (if halted)

in EventEmitter at line 178
mixed fireSystemEvent(string $event, array $params = [], bool $halt = true)

Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.

For example:

$this->fireSystemEvent('admin.form.myEvent', ['my value']);

Is equivalent to:

$this->fireEvent('form.myEvent', ['myvalue'], true);

Event::fire('admin.form.myEvent', [$this, 'myvalue'], true);

Parameters

string $event

Event name

array $params

Event parameters

bool $halt

Halt after first non-null result

Return Value

mixed

in Model at line 116
protected void bootIfNotBooted()

Check if the model needs to be booted and if so, do it.

Return Value

void

in Model at line 40
static protected void boot()

The "booting" method of the model.

Return Value

void

in Model at line 144
static protected void bootTraits()

Boot all of the bootable traits on the model.

Return Value

void

in Model at line 160
static void clearBootedModels()

Clear the list of booted models so they will be re-booted.

Return Value

void

in Model at line 170
static Model|Finder on($source)

No description

Parameters

$source

Return Value

Model|Finder

in Model at line 184
static SourceInterface resolveSource(string|null $source = null)

No description

Parameters

string|null $source

Return Value

SourceInterface

in Model at line 193
static SourceResolverInterface getSourceResolver()

Get the source resolver instance.

in Model at line 205
static void setSourceResolver(SourceResolverInterface $resolver)

Set the source resolver instance.

Parameters

SourceResolverInterface $resolver

Return Value

void

in Model at line 214
static void unsetSourceResolver()

Unset the source resolver for models.

Return Value

void

in Model at line 227
static Collection hydrate(array $items, string|null $source = null)

Create a collection of models from plain arrays.

Parameters

array $items
string|null $source

Return Value

Collection

in Model at line 246
static Model create(array $attributes = [])

Save a new model and return the instance.

Parameters

array $attributes

Return Value

Model

in Model at line 260
static Finder query()

Begin querying the model.

Return Value

Finder

in Model at line 270
static Collection|Model[] all()

Get all of the models from the source.

Return Value

Collection|Model[]

in Model at line 286
$this fill(array $attributes)

Fill the model with an array of attributes.

Parameters

array $attributes

Return Value

$this

Exceptions

MassAssignmentException

in Model at line 300
SourceInterface getSource()

No description

Return Value

SourceInterface

in Model at line 310
Model setSource($source)

No description

Parameters

$source

Return Value

Model

in Model at line 321
string getSourceName()

Get the current source name for the model.

Return Value

string

in Model at line 330
string getBaseFileNameAttribute()

Returns the file name without the extension.

Return Value

string

in Model at line 345
array getSettingsAttribute()

The settings is attribute contains everything that should be saved to the settings area.

Return Value

array

in Model at line 364
setSettingsAttribute(mixed $value)

Filling the settings should merge it with attributes.

Parameters

mixed $value

in Model at line 375
setFileNameAttribute(mixed $value)

File name should always contain an extension.

Parameters

mixed $value

in Model at line 391
string getTypeDirName()

Returns the directory name corresponding to the object type.

For pages the directory name is "_pages", for layouts - "_layouts", etc.

Return Value

string

in Model at line 400
array getAllowedExtensions()

Returns the allowable file extensions supported by this model.

Return Value

array

in Model at line 409
int getMaxNesting()

Returns the maximum directory nesting allowed by this template.

Return Value

int

in Model at line 421
array getFileNameParts(string $fileName = null)

Returns the base file name and extension. Applies a default extension, if none found.

Parameters

string $fileName

Return Value

array

in Model at line 450
Finder newFinder()

Get a new file finder for the object

Return Value

Finder

in Model at line 466
Collection newCollection(array $models = [])

Create a new Collection instance.

Parameters

array $models

Return Value

Collection

in Model at line 479
Model newInstance(array $attributes = [], bool $exists = false)

Create a new instance of the given model.

Parameters

array $attributes
bool $exists

Return Value

Model

in Model at line 499
Model newFromFinder(array $attributes = [], string|null $source = null)

Create a new model instance that is existing.

Parameters

array $attributes
string|null $source

Return Value

Model

in Model at line 519
bool|int update(array $attributes = [])

Update the model in the database.

Parameters

array $attributes

Return Value

bool|int

in Model at line 535
bool save(array $options = [])

Save the model to the source.

Parameters

array $options

Return Value

bool

in Model at line 547
bool saveInternal(array $options = [])

Save the model to the database. Is used by save()} and {@link forceSave().

Parameters

array $options

Return Value

bool

in Model at line 584
protected void finishSave(array $options)

Finish processing on a successful save operation.

Parameters

array $options

Return Value

void

in Model at line 601
protected bool performUpdate(Finder $query, array $options = [])

Perform a model update operation.

Parameters

Finder $query
array $options

Return Value

bool

in Model at line 633
protected bool performInsert(Finder $query, array $options = [])

Perform a model insert operation.

Parameters

Finder $query
array $options

Return Value

bool

in Model at line 662
bool|null delete()

Delete the model from the database.

Return Value

bool|null

Exceptions

Exception

in Model at line 691
protected void performDeleteOnModel()

Perform the actual delete query on this model instance.

Return Value

void

in Model at line 700
string __toString()

Convert the model to its string representation.

Return Value

string

in Model at line 291
bool __isset(string $key)

Determine if an attribute exists on the object.

Parameters

string $key

Return Value

bool

in Model at line 788
void __unset(string $key)

Unset an attribute on the model.

Parameters

string $key

Return Value

void

in Model at line 800
bool offsetExists(mixed $offset)

Determine if the given attribute exists.

Parameters

mixed $offset

Return Value

bool

in Model at line 812
mixed offsetGet(mixed $offset)

Get the value for a given offset.

Parameters

mixed $offset

Return Value

mixed

in Model at line 825
void offsetSet(mixed $offset, mixed $value)

Set the value for a given offset.

Parameters

mixed $offset
mixed $value

Return Value

void

in Model at line 837
void offsetUnset(mixed $offset)

Unset the value for a given offset.

Parameters

mixed $offset

Return Value

void

in Model at line 846
array toArray()

Get the instance as an array.

Return Value

array

in Model at line 858
string toJson(int $options = 0)

Convert the model instance to JSON.

Parameters

int $options

Return Value

string

in Model at line 868
array jsonSerialize()

Convert the object into something JSON serializable.

Return Value

array

in HasComponents at line 19
static void bootHasComponents()

Boot the sortable trait for this model.

Return Value

void

in HasComponents at line 26
parseComponentSettings()

No description

in HasComponents at line 52
BaseComponent getComponent(string $componentName)

Returns a component by its name.

This method is used only in the admin and for internal system needs when the standard way to access components is not an option.

Parameters

string $componentName

Specifies the component name.

Return Value

BaseComponent

in HasComponents at line 71
mixed hasComponent(string $componentName)

Checks if the object has a component with the specified name.

Parameters

string $componentName

Specifies the component name.

Return Value

mixed

Return false or the full component name used on the page (it could include the alias).

in HasComponents at line 96
runComponents()

No description

in HasComponents at line 110
updateComponent($alias, array $properties)

No description

Parameters

$alias
array $properties

in HasViewBag at line 25
static void bootHasViewBag()

Boot the sortable trait for this model.

Return Value

void

in HasViewBag at line 32
parseSettings()

No description

in HasViewBag at line 43
ViewBag getViewBag()

Returns the configured view bag component.

This method is used only in the back-end and for internal system needs when the standard way to access components is not an option.

Return Value

ViewBag

in HasViewBag at line 66
protected void fillViewBagArray()

Copies view bag properties to the view bag array.

This is required for the back-end editors.

Return Value

void

in Model at line 50
static protected void bootDefaultTheme()

Boot all of the bootable traits on the model.

Return Value

void

in Model at line 72
static mixed load(Theme $theme, string $fileName)

Loads the object from a file.

This method is used in the admin. It doesn't use any caching.

Parameters

Theme $theme

Specifies the theme the object belongs to.

string $fileName

Return Value

mixed

in Model at line 86
static mixed loadCached(Theme $theme, string $fileName)

Loads the object from a cache.

This method is used by the main in the runtime. If the cache is not found, it is created.

Parameters

Theme $theme

Specifies the theme the object belongs to.

string $fileName

Return Value

mixed

in Model at line 102
static array|Collection listInTheme(Theme $theme, bool $skipCache = false)

Returns the list of objects in the specified theme.

This method is used internally by the system.

Parameters

Theme $theme

Specifies a parent theme.

bool $skipCache

Indicates if objects should be reloaded from the disk bypassing the cache.

Return Value

array|Collection

in Model at line 120
static inTheme(Theme $theme)

No description

Parameters

Theme $theme

in Model at line 125
static getDropdownOptions(Theme $theme = null, $skipCache = false)

No description

Parameters

Theme $theme
$skipCache

in Model at line 149
string getId()

Returns the unique id of this object.

ex. account/login.blade.php => account-login

Return Value

string

in Model at line 160
Theme getThemeAttribute($value = null)

Returns the theme this object belongs to.

Parameters

$value

Return Value

Theme

in Model at line 182
string getFilePath(string $fileName = null)

Returns the local file path to the template.

Parameters

string $fileName

Return Value

string

in Model at line 200
string getFileName()

Returns the file name.

Return Value

string

in Model at line 209
string getBaseFileName()

Returns the file name without the extension.

Return Value

string

in Model at line 218
string getContent()

Returns the file content.

Return Value

string

in Model at line 227
string getMarkup()

Gets the markup section of a template

Return Value

string

The template source code

in Model at line 236
string getCode()

Gets the code section of a template

Return Value

string

The template source code

in Model at line 245
string getTemplateCacheKey()

Returns the key used by the Template cache.

Return Value

string

at line 17
static initFallback($theme)

No description

Parameters

$theme

at line 31
mixed getCodeClassParent()

Returns name of a PHP class to use as parent for the PHP class created for the template's PHP section.

Return Value

mixed

Returns the class name or null.