Setting
extends Model
in package
implements
ModelOwnership, DynamicallyCastsTypes
Uses
HasOwner, AliasesSnakeCaseAttributes
Setting
Tags
Interfaces, Classes, Traits and Enums
- ModelOwnership
- ModelOwnership
- DynamicallyCastsTypes
- DynamicallyCastsTypes
Table of Contents
- $data_type : DataType|null
- $dataType : DataType|null
- $id : int
- $owner : mixed
- $setting_type : SettingType|null
- $settingType : SettingType|null
- $value : mixed
- $casts : mixed
- $fillable : mixed
- belongsToModel() : bool
- getAttribute() : mixed
- getConnection() : Connection
- Get the database connection for the model.
- getDataType() : DataType
- Get the DataType for this Model.
- getTable() : string
- Get the table associated with the model.
- hasOwner() : bool
- isAppSetting() : bool
- Is this an App setting?
- isGlobalSetting() : bool
- Is this a Global setting?
- isModelSetting() : bool
- Is this a Model setting?
- isSettingType() : bool
- Check if this is the same SettingType as given.
- isUserSetting() : bool
- Is this a User setting?
- modelFromArray() : Model|null
- Get a new model instance from an array.
- modelFromJson() : Model|null
- Get a new model instance from JSON.
- morphTo() : MorphTo
- Define a polymorphic, inverse one-to-one or many relationship.
- newCollection() : SettingsCollection
- owner() : MorphTo
- setAttribute() : mixed
- setOwner() : static
Properties
$data_type
public
DataType|null
$data_type
$dataType
public
DataType|null
$dataType
$id
public
int
$id
$owner
public
mixed
$owner
$setting_type
public
SettingType|null
$setting_type
$settingType
public
SettingType|null
$settingType
$value
public
mixed
$value
$casts
protected
mixed
$casts
= ['data_type' => \Envorra\LaravelSettings\Enums\DataType::class, 'setting_type' => \Envorra\LaravelSettings\Enums\SettingType::class, 'value' => \Envorra\LaravelSettings\Casters\DynamicTypeCaster::class]
Tags
$fillable
protected
mixed
$fillable
= ['key', 'description', 'data_type', 'value']
Tags
Methods
belongsToModel()
public
belongsToModel(Model $model) : bool
Parameters
- $model : Model
Tags
Return values
bool —getAttribute()
public
getAttribute(mixed $key) : mixed
Parameters
- $key : mixed
Tags
Return values
mixed —getConnection()
Get the database connection for the model.
public
abstract getConnection() : Connection
Tags
Return values
Connection —getDataType()
Get the DataType for this Model.
public
getDataType() : DataType
Tags
Return values
DataType —getTable()
Get the table associated with the model.
public
abstract getTable() : string
Tags
Return values
string —hasOwner()
public
hasOwner() : bool
Tags
Return values
bool —isAppSetting()
Is this an App setting?
public
isAppSetting() : bool
Return values
bool —isGlobalSetting()
Is this a Global setting?
public
isGlobalSetting() : bool
Return values
bool —isModelSetting()
Is this a Model setting?
public
isModelSetting() : bool
Return values
bool —isSettingType()
Check if this is the same SettingType as given.
public
isSettingType(SettingType|string|array<string|int, mixed> $type) : bool
Parameters
- $type : SettingType|string|array<string|int, mixed>
Return values
bool —isUserSetting()
Is this a User setting?
public
isUserSetting() : bool
Return values
bool —modelFromArray()
Get a new model instance from an array.
public
static modelFromArray(array<string|int, mixed> $attributes) : Model|null
Parameters
- $attributes : array<string|int, mixed>
Return values
Model|null —modelFromJson()
Get a new model instance from JSON.
public
static modelFromJson(string $json) : Model|null
Parameters
- $json : string
Return values
Model|null —morphTo()
Define a polymorphic, inverse one-to-one or many relationship.
public
abstract morphTo([string|null $name = null ][, string|null $type = null ][, string|null $id = null ][, string|null $ownerKey = null ]) : MorphTo
Parameters
- $name : string|null = null
- $type : string|null = null
- $id : string|null = null
- $ownerKey : string|null = null
Tags
Return values
MorphTo —newCollection()
public
newCollection([iteratable<string|int, mixed> $models = [] ]) : SettingsCollection
Parameters
- $models : iteratable<string|int, mixed> = []
Tags
Return values
SettingsCollection —owner()
public
owner() : MorphTo
Tags
Return values
MorphTo —setAttribute()
public
setAttribute(mixed $key, mixed $value) : mixed
Parameters
- $key : mixed
- $value : mixed
Tags
Return values
mixed —setOwner()
public
setOwner(Model $owner) : static
Parameters
- $owner : Model