BrandSetting
Brand settings that affect all users
class Backend\Models\BrandSetting
extends Model
Extends
Class | Description |
---|---|
Model
|
Traits
Trait | Description |
---|---|
Validation
|
|
ViewMaker
|
View Maker Trait Adds view based methods to a class |
Constants
Constant | Type | Value | Description |
---|---|---|---|
ACCENT_COLOR
|
string |
"#3498db"
|
string
"#3498db"
|
COLLAPSE_MENU
|
string |
"collapse"
|
string
"collapse"
|
INLINE_MENU
|
string |
"inline"
|
string
"inline"
|
PRIMARY_COLOR
|
string |
"#34495e"
|
string
"#34495e"
|
SECONDARY_COLOR
|
string |
"#e67e22"
|
string
"#e67e22"
|
TILE_MENU
|
string |
"tile"
|
string
"tile"
|
Properties
public
$attachOne
:
mixed
= {"favicon":{},"logo":{}}
public
$cacheKey
:
string
= "backend::brand.custom_css"
The key to store rendered CSS in the cache under
public
$implement
:
array
= [{}]
Behaviors implemented by this model.
public
$rules
:
mixed
= {"app_name":"required","app_tagline":"required"}
Validation rules
public
$settingsCode
:
string
= "backend_brand_settings"
Unique code
public
$settingsFields
:
mixed
= "fields.yaml"
Settings form field definitions
inherited public $layout : string
Layout to use for the view.
inherited
public
$suppressLayout
:
bool
= false
Prevents the use of a layout.
inherited
public
$vars
:
array
= []
A list of variables to pass to the page.
inherited protected $layoutPath : string
Specifies a path to the layout directory.
inherited
protected
$validationDefaultAttrNames
:
array
= []
Default custom attribute names.
inherited protected $validationErrors : Illuminate\Support\MessageBag
The message bag instance containing validation error messages
inherited protected $viewPath : string | array
Specifies a path to the views directory.
Methods
public afterSave ()
public static compileCss ()
public static getDefaultFavicon ()
public static getDefaultLogo ()
public static getFavicon ()
public static getLogo ()
public initSettingsData () : void
Initialize the seed data for this model. This only executes when the model is first created or reset to default.
public static isBaseConfigured ()
public static renderCss ()
inherited public addViewPath (string | array $path) : void
Prepends a path on the available view path locations.
Property | Type | Description |
---|---|---|
$path | string | array |
string | array
|
inherited public static bootValidation () : void
Boot the validation trait for this model.
inherited public errors () : Illuminate\Support\MessageBag
Get validation error message collection for the Model
inherited
public
forceSave ($options = null
, $sessionKey = null
)
: bool
Force save the model even if validation fails.
Property | Type | Description |
---|---|---|
$options | mixed |
mixed
|
$sessionKey | mixed |
mixed
|
inherited
public
getViewPath (string $fileName, $viewPaths = null
)
: string
Locates a file based on its definition. The file name can be prefixed with a symbol (~|$) to return in context of the application or plugin base path, otherwise it will be returned in context of this object view path.
If the fileName cannot be found it will be returned unmodified.
Property | Type | Description |
---|---|---|
$fileName | string |
string
|
$viewPaths | mixed |
mixed
|
inherited public getViewPaths () : array
Returns the active view path locations.
inherited
public
guessViewPath (string $suffix = ""
, boolean $isPublic = false
)
: string | null
Guess the package path for the called class.
Property | Type | Description |
---|---|---|
$suffix | string |
string
An extra path to attach to the end |
$isPublic | boolean |
boolean
Returns public path instead of an absolute one |
inherited
public
guessViewPathFrom (string $class, string $suffix = ""
, boolean $isPublic = false
)
: string | null
Guess the package path from a specified class.
Property | Type | Description |
---|---|---|
$class | string |
string
Class to guess path from. |
$suffix | string |
string
An extra path to attach to the end |
$isPublic | boolean |
boolean
Returns public path instead of an absolute one |
inherited
public
isAttributeRequired (string $attribute, boolean $checkDependencies = true
)
: bool
Determines if an attribute is required based on the validation rules.
Property | Type | Description |
---|---|---|
$attribute | string |
string
|
$checkDependencies | boolean |
boolean
Checks the attribute dependencies (for required_if & required_with rules). Note that it will only be checked up to the next level, if another dependent rule is found then it will just assume the field is required |
inherited
public
makeFileContents (string $filePath, array $extraParams = []
)
: string
Includes a file path using output buffering, making the provided vars available.
Property | Type | Description |
---|---|---|
$filePath | string |
string
|
$extraParams | array |
array
|
inherited
public
makeLayout ($name = null
, array $params = []
, boolean $throwException = true
)
: string | bool
Render a layout, defaulting to the layout propery specified on the class
Property | Type | Description |
---|---|---|
$name | mixed |
mixed
|
$params | array |
array
|
$throwException | boolean |
boolean
|
The layout contents, or false.
inherited
public
makeLayoutPartial (string $partial, array $params = []
)
: string
Renders a layout partial
Property | Type | Description |
---|---|---|
$partial | string |
string
|
$params | array |
array
|
inherited
public
makePartial (string $partial, array $params = []
, boolean $throwException = true
)
: mixed
Render a partial file contents located in the views folder.
Property | Type | Description |
---|---|---|
$partial | string |
string
|
$params | array |
array
|
$throwException | boolean |
boolean
|
Partial contents or false if not throwing an exception.
inherited public makeView (string $view) : string
Loads the specified view. Applies the layout if one is set.
The view file must have the .php extension (or ".htm" for historical reasons) and be located in the views directory
Property | Type | Description |
---|---|---|
$view | string |
string
|
inherited
public
makeViewContent (string $contents, $layout = null
)
: string
Renders supplied contents inside a layout.
Property | Type | Description |
---|---|---|
$contents | string |
string
|
$layout | mixed |
mixed
|
inherited public setValidationAttributeName (string $attr, string $name) : void
Programatically sets the validation attribute names, will take lower priority
to model defined attribute names found in $attributeNames
.
Property | Type | Description |
---|---|---|
$attr | string |
string
|
$name | string |
string
|
inherited public setValidationAttributeNames (array $attributeNames) : void
Programatically sets multiple validation attribute names.
Property | Type | Description |
---|---|---|
$attributeNames | array |
array
|
inherited
public
validate ($rules = null
, $customMessages = null
, $attributeNames = null
)
: bool
Validate the model instance
Property | Type | Description |
---|---|---|
$rules | mixed |
mixed
|
$customMessages | mixed |
mixed
|
$attributeNames | mixed |
mixed
|
inherited public static validated (Closure | string $callback) : void
Create a new native event for handling afterValidate().
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
inherited public static validating (Closure | string $callback) : void
Create a new native event for handling beforeValidate().
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
inherited protected getRelationValidationValue ($relationName)
Attachments validate differently to their simple values.
Property | Type | Description |
---|---|---|
$relationName | mixed |
mixed
|
inherited protected getValidationAttributes () : array
Returns the model data used for validation.
inherited protected handleViewException (Throwable $e, integer $obLevel) : void
Handle a view exception.
Property | Type | Description |
---|---|---|
$e | Throwable |
Throwable
|
$obLevel | integer |
integer
|
inherited
protected
static
makeValidator ($data, $rules, $customMessages, $attributeNames, $connection = null
)
: Illuminate\Contracts\Validation\Validator
Instantiates the validator used by the validation process, depending if the class is being used inside or outside of Laravel. Optional connection string to make the validator use a different database connection than the default connection.
Property | Type | Description |
---|---|---|
$data | mixed |
mixed
|
$rules | mixed |
mixed
|
$customMessages | mixed |
mixed
|
$attributeNames | mixed |
mixed
|
$connection | mixed |
mixed
|
inherited protected processRuleFieldNames (array $rules) : array
Processes field names in a rule array.
Converts any field names using array notation (ie. field[child]
) into dot notation (ie. field.child
)
Property | Type | Description |
---|---|---|
$rules | array |
array
Rules array |
inherited protected processValidationRules ($rules)
Process rules
Property | Type | Description |
---|---|---|
$rules | mixed |
mixed
|
inherited protected processValidationUniqueRule (string $definition, string $fieldName) : string
Rebuilds the unique validation rule to force for the existing ID
Property | Type | Description |
---|---|---|
$definition | string |
string
|
$fieldName | string |
string
|