• ArrayAccess
  • Illuminate\Contracts\Support\Arrayable
  • Illuminate\Contracts\Support\Jsonable
  • JsonSerializable
  • Cms\Contracts\CmsObject

This is a base class for all CMS objects - content files, pages, partials and layouts. The class implements basic operations with file-based templates.

Public properties

public array $rules

The rules to be applied to the data.

public array $attributeNames

The array of custom attribute names.

public array $customMessages

The array of custom error messages.

Show inherited public properties

Inherited public properties

Protected properties

protected array $fillable

The attributes that are mass assignable.

protected bool $isCompoundObject

Model supports code and settings sections.

protected Cms\Classes\Theme $themeCache

A reference to the CMS theme containing the object.

protected Illuminate\Support\MessageBag $validationErrors

The message bag instance containing validation error messages

protected static Illuminate\Validation\Validator $validator

The validator instance.

Show inherited protected properties

Inherited protected properties

Public methods

public static void bootValidation()

Boot the validation trait for this model.

public Illuminate\Support\MessageBag errors()

Get validation error message collection for the Model

public bool forceSave($options=NULL)

Force save the model even if validation fails.

  • $options

public string getBaseFileName()

Returns the file name without the extension.

public string getContent()

Returns the file content.

public string getFileName()

Returns the file name.

public string getFilePath(string $fileName=NULL)

Returns the full path to the template file corresponding to this object.

  • string $fileName

public string getId()

Helper for {{ }} or {{ }} twig vars Returns a unique string for this object.

public static Illuminate\Validation\Validator getModelValidator()

Get the validator instance.

public Cms\Classes\Theme getThemeAttribute()

Returns the CMS theme this object belongs to.

public string getTwigCacheKey()

Returns the key used by the Twig cache.

public string getTwigContent()

Returns the Twig content string.

public static $this inTheme(Cms\Classes\Theme $theme)

Prepares the theme datasource for the model.


public boolean isAttributeRequired(string $attribute)

Determines if an attribute is required based on the validation rules.

  • string $attribute

public static Collection listInTheme(Cms\Classes\Theme $theme, boolean $skipCache=false)

Returns the list of objects in the specified theme. This method is used internally by the system.

  • Cms\Classes\Theme $theme - Specifies a parent theme.
  • boolean $skipCache - Indicates if objects should be reloaded from the disk bypassing the cache.

public static mixed load(mixed $theme, string $fileName)

Loads the object from a file. This method is used in the CMS back-end. It doesn't use any caching.

  • mixed $theme - Specifies the theme the object belongs to.
  • string $fileName - Specifies the file name, with the extension. The file name can contain only alphanumeric symbols, dashes and dots.

public static mixed loadCached(Cms\Classes\Theme $theme, string $fileName)

Loads the object from a cache. This method is used by the CMS in the runtime. If the cache is not found, it is created.

  • Cms\Classes\Theme $theme - Specifies the theme the object belongs to.
  • string $fileName - Specifies the file name, with the extension.

public bool save(array $options=NULL)

Save the object to the theme.

  • array $options

public static void setModelValidator(Illuminate\Validation\Validator $validator)

Set the validator instance.

  • Illuminate\Validation\Validator $validator

public static void unsetModelValidator()

Unset the validator for models.

public bool validate($rules=NULL, $customMessages=NULL, $attributeNames=NULL)

Validate the model instance

  • $rules
  • $customMessages
  • $attributeNames

public static void validated(Closure|string $callback)

Create a new native event for handling afterValidate().

  • Closure|string $callback

public static void validating(Closure|string $callback)

Create a new native event for handling beforeValidate().

  • Closure|string $callback

Show inherited public methods

Inherited public methods

Protected methods

protected static void boot()

The "booting" method of the model.

protected static void bootDefaultTheme()

Boot all of the bootable traits on the model.

protected array getValidationAttributes()

Returns the model data used for validation.

protected static Illuminate\Validation\Validator makeValidator($data, $rules, $customMessages, $attributeNames)

Instantiates the validator used by the validation process, depending if the class is being used inside or outside of Laravel.

  • $data
  • $rules
  • $customMessages
  • $attributeNames

protected array processRuleFieldNames(array $rules)

Processes field names in a rule array.

Converts any field names using array notation (ie. field[child]) into dot notation (ie. field.child)

  • array $rules - Rules array

protected void processValidationRules($rules)

Process rules

  • $rules

protected static void throwHalcyonException(Exception $ex)

Converts an exception type thrown by Halcyon to a native CMS exception.

  • Exception $ex

Show inherited protected methods

Inherited protected methods

  • protected void bootIfNotBooted() - defined in October\Rain\Halcyon\Model. Check if the model needs to be booted and if so, do it.
  • protected void bootNicerEvents() - defined in October\Rain\Halcyon\Model. Bind some nicer events to this model, in the format of method overrides.
  • protected static void bootTraits() - defined in October\Rain\Halcyon\Model. Boot all of the bootable traits on the model.
  • protected array emitterEventSortEvents(string $eventName) - defined in October\Rain\Halcyon\Model. Sort the listeners for a given event by priority.
  • protected boolean extendableIsAccessible(mixed $class, string $propertyName) - defined in October\Rain\Extension\Extendable. Checks if a property is accessible, property equivalent of is_callable().
  • protected void extensionExtractMethods(string $extensionName, object $extensionObject) - defined in October\Rain\Extension\Extendable. Extracts the available methods from a behavior and adds it to the.
  • protected array fillableFromArray(array $attributes) - defined in October\Rain\Halcyon\Model. Get the fillable attributes of a given array.
  • protected void finishSave(array $options) - defined in October\Rain\Halcyon\Model. Finish processing on a successful save operation.
  • protected mixed fireModelEvent(string $event, bool $halt=true) - defined in October\Rain\Halcyon\Model. Fire the given event for the model.
  • protected array getArrayableAppends() - defined in October\Rain\Halcyon\Model. Get all of the appendable values that are arrayable.
  • protected mixed getAttributeFromArray(string $key) - defined in October\Rain\Halcyon\Model. Get an attribute from the $attributes array.
  • protected mixed mutateAttribute(string $key, mixed $value) - defined in October\Rain\Halcyon\Model. Get the value of an attribute using its mutator.
  • protected mixed mutateAttributeForArray(string $key, mixed $value) - defined in October\Rain\Halcyon\Model. Get the value of an attribute using its mutator for array conversion.
  • protected bool originalIsNumericallyEquivalent(string $key) - defined in October\Rain\Halcyon\Model. Determine if the new and old values for a given key are numerically equivalent.
  • protected void performDeleteOnModel() - defined in October\Rain\Halcyon\Model. Perform the actual delete query on this model instance.
  • protected bool performInsert(October\Rain\Halcyon\Builder $query, array $options=array()) - defined in October\Rain\Halcyon\Model. Perform a model insert operation.
  • protected bool performUpdate(October\Rain\Halcyon\Builder $query, array $options=array()) - defined in October\Rain\Halcyon\Model. Perform a model update operation.
  • protected static void registerModelEvent(string $event, Closure|string $callback, int $priority=0) - defined in October\Rain\Halcyon\Model. Register a model event with the dispatcher.