class Attribute extends BaseModel (View source)

Traits

Properties

protected array $guarded

Define which attributes should be protected from mass assignment.

protected array $casts

Define which attributes should be cast.

int $id
string $attribute_type
int $attribute_group_id
int $position
string $name
string $handle
string $section
string $type
bool $required
?string $default_value
string $configuration
bool $system
string $validation_rules
bool $filterable
bool $searchable
Carbon $created_at
Carbon $updated_at

Methods

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

Get new instance of the registered model.

mixed
__call(string $method, array $parameters)

Handle dynamic and static method calls into the model.

Model
swap(string $newModelClass)

Swap the model implementation.

string
getMorphClass()

Get the class name of the base model.

bool
forwardCallsWhen(string $method, Model $model)

Forward a method call to the model only when calling a method on the model.

static void
registerModelEvent(string $event, QueuedClosure|Closure|string $callback)

Register a model event with the dispatcher.

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

Fire the given event for the model.

static void
flushEventListeners()

Remove all the event listeners for the model.

__construct(array $attributes = [])

Create a new instance of the Model.

string
translate(string $attribute, string $locale = null)

Translate a given attribute based on passed locale.

string
translateAttribute(string $attribute, string $locale = null)

Translate a value from attribute data.

void
attr(...$params)

Shorthand to translate an attribute.

static mixed
__callStatic(string $method, array $parameters)

Handle dynamic static method calls into the model.

static 
boot()

No description

static AttributeFactory
newFactory()

Return a new factory instance for the model.

MorphTo
attributable()

Return the attribuable relation.

BelongsTo
attributeGroup()

Returns the attribute group relation.

void
scopeSystem(Builder $query, string $type)

Apply the system scope to the query builder.

Details

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

Get new instance of the registered model.

Parameters

array $attributes
bool $exists

Return Value

Model

mixed __call(string $method, array $parameters)

Handle dynamic and static method calls into the model.

Parameters

string $method
array $parameters

Return Value

mixed

Model swap(string $newModelClass)

Swap the model implementation.

Parameters

string $newModelClass

Return Value

Model

string getMorphClass()

Get the class name of the base model.

Return Value

string

protected bool forwardCallsWhen(string $method, Model $model)

Forward a method call to the model only when calling a method on the model.

Parameters

string $method
Model $model

Return Value

bool

static protected void registerModelEvent(string $event, QueuedClosure|Closure|string $callback)

Register a model event with the dispatcher.

Parameters

string $event
QueuedClosure|Closure|string $callback

Return Value

void

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

Fire the given event for the model.

Parameters

string $event
bool $halt

Return Value

mixed

static void flushEventListeners()

Remove all the event listeners for the model.

Return Value

void

__construct(array $attributes = [])

Create a new instance of the Model.

Parameters

array $attributes

string translate(string $attribute, string $locale = null)

Translate a given attribute based on passed locale.

Parameters

string $attribute
string $locale

Return Value

string

string translateAttribute(string $attribute, string $locale = null)

Translate a value from attribute data.

Parameters

string $attribute
string $locale

Return Value

string

void attr(...$params)

Shorthand to translate an attribute.

Parameters

...$params

Return Value

void

static mixed __callStatic(string $method, array $parameters)

Handle dynamic static method calls into the model.

Parameters

string $method
array $parameters

Return Value

mixed

static boot()

No description

static protected AttributeFactory newFactory()

Return a new factory instance for the model.

Return Value

AttributeFactory

MorphTo attributable()

Return the attribuable relation.

Return Value

MorphTo

BelongsTo attributeGroup()

Returns the attribute group relation.

Return Value

BelongsTo

void scopeSystem(Builder $query, string $type)

Apply the system scope to the query builder.

Parameters

Builder $query
string $type

Return Value

void