Skip to main content

Aero\\Common\\Traits\\CastsToJavaScript

This trait can be added to a model class. This trait provides a way of defining attributes that should be kept when casting to javascript. You can define these attributes in a protected $castsToJsarray. The trait adds the following methods:

static addCastToJs Method

This static method provides a way to dynamically add attributes to the models $castsToJsarray. It expects you to pass the attribute key to be added.

jsSerialize Method

This method returns the value of the attributesToJsmethod.

toJavaScript Method

This method returns the JSON value of the jsSerializemethod.

attributesToJs Method

This method returns an array of the attributes that should be casted to javascript.

getCastsToJs Method

This method returns the attribute keys that should be cast to javascript.