class Orders_model extends Model

Orders Model Class

Traits

Extendable Trait Allows for "Private traits"

Adds event related features to any class.

Constants

DELIVERY

COLLECTION

Properties

protected array $extensionData from  ExtendableTrait
static protected array $extendableCallbacks from  ExtendableTrait
static protected array $extendableStaticMethods from  ExtendableTrait
static protected bool $extendableGuardProperties from  ExtendableTrait
static protected ClassLoader $extendableClassLoader from  ExtendableTrait
protected array $emitterSingleEvents from  EventEmitter
protected array $emitterEvents from  EventEmitter
protected array $emitterEventSorted from  EventEmitter
$relation
static protected array $relationTypes from  HasRelationships
array $implement from  Model
protected array $attributes from  Model
array $timestamps
protected $timeFormat
protected $casts
static protected array $eventsBooted from  Model
static protected string[] $primitiveCastTypes

The built-in, primitive cast types supported by Eloquent.

from  Model
$formWidgetStatusData from  LogsStatusHistory
bool $locationScopeEnabled from  Locationable
protected string $table
protected string $primaryKey
$guarded
protected $hidden
$appends
static $allowedSortingColumns

Methods

extendableConstruct()

Constructor.

static void
extendableExtendCallback(callable $callback)

Helper method for ::extend() static method

static void
clearExtendedClasses()

Clear the list of extended classes so they will be re-extended.

string
extensionNormalizeClassName(string $name)

Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes

extendClassWith(string $extensionName)

Dynamically extend a class with a specified behavior

void
extensionExtractMethods(string $extensionName, object $extensionObject)

Extracts the available methods from a behavior and adds it to the list of callable methods.

addDynamicMethod(string $dynamicName, callable $method, string $extension = null)

Programmatically adds a method to the extendable class

addDynamicProperty(string $dynamicName, string $value = null)

Programatically adds a property to the extendable class

bool
isClassExtendedWith(string $name)

Check if extendable class is extended with a behavior object

mixed
getClassExtension(string $name)

Returns a behavior object from an extendable class, example:

mixed
asExtension(string $shortName)

Short hand for getClassExtension() method, except takes the short extension name, example:

bool
methodExists(string $name)

Checks if a method exists, extension equivalent of method_exists()

array
getClassMethods()

Get a list of class methods, extension equivalent of get_class_methods()

array
getDynamicProperties()

Returns all dynamic properties and their values

bool
propertyExists(string $name)

Checks if a property exists, extension equivalent of property_exists()

bool
extendableIsAccessible(mixed $class, string $propertyName)

Checks if a property is accessible, property equivalent of is_callabe()

string
extendableGet(string $name)

Magic method for __get()

string
extendableSet(string $name, string $value)

Magic method for __set()

mixed
extendableCall(string $name, array $params = null)

Magic method for __call()

static mixed
extendableCallStatic(string $name, array $params = null)

Magic method for __callStatic()

ClassLoader|null
extensionGetClassLoader()

Gets the class loader

bindEvent(string $event, callable $callback, int $priority = 0)

Create a new event binding.

bindEventOnce(string $event, callable $callback)

Create a new event binding that fires once only

void
emitterEventSortEvents(string $eventName)

Sort the listeners for a given event by priority.

unbindEvent(string $event = null)

Destroys an event binding.

string|array
fireEvent(string $event, array $params = [], bool $halt = false)

Fire an event and call the listeners.

mixed
fireSystemEvent(string $event, array $params = [], bool $halt = true)

Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.

void
addCasts(array $attributes)

Add attribute casts for the model.

getAttribute($key)

No description

getAttributeValue($key)

No description

attributesToArray()

No description

setAttribute(string $key, mixed $value)

Set a given attribute on the model.

asSerialized($value)

No description

fromSerialized($value)

No description

isSerializedCastable($key)

No description

asDateTime($value)

No description

asTime($value)

No description

string
fromTime(Carbon|int $value)

Convert a Carbon Time to a storable string.

bool
isTimeCastable(string $key)

Determine whether a value is Time castable for inbound manipulation.

string
getTimeFormat()

Get the format for database stored times.

setTimeFormat(string $format)

Set the time format used by the model.

hasRelation($name)

No description

array
getRelationDefinition(string $name)

Returns relationship details from a supplied name.

array
getRelationDefinitions()

Returns relationship details for all relations defined on this model.

string
getRelationType(string $name)

Returns a relationship type based on a supplied name.

mixed
getRelationValue(string $key)

Get a relationship.

$this
setRelationValue($relationName, $value)

Sets a relation value directly from its attribute.

string
makeRelation(string $name)

Returns a relation class object

bool
isRelationPushable(string $name)

Determines whether the specified relation should be saved when push() is called instead of save() on the model. Default: true.

array
getRelationDefaults(string $type)

Returns default relation arguments for a given type.

handleRelation($relationName)

No description

array
validateRelationArgs($relationName, $optional, array $required = [])

Validate relation supplied arguments.

HasOne
hasOne(string $related, string|null $foreignKey = null, string|null $localKey = null, null $relationName = null)

Define a one-to-one relationship.

hasOneThrough($related, $through, $primaryKey = null, $throughKey = null, $localKey = null, $secondLocalKey = null, $relationName = null)

Define a has-one-through relationship.

HasMany
hasMany(string $related, string|null $foreignKey = null, string|null $localKey = null, null $relationName = null)

Define a one-to-many relationship.

HasManyThrough
hasManyThrough(string $related, string $through, string|null $firstKey = null, string|null $secondKey = null, string|null $localKey = null, string|null $secondLocalKey = null, null $relationName = null)

Define a has-many-through relationship.

belongsTo($related, $foreignKey = null, $ownerKey = null, $relationName = null)

No description

belongsToMany($related, $table = null, $foreignPivotKey = null, $relatedPivotKey = null, $parentKey = null, $relatedKey = null, $relationName = null)

No description

MorphOne
morphOne(string $related, string $name, string|null $type = null, string|null $id = null, string|null $localKey = null, null $relationName = null)

Define a polymorphic one-to-one relationship.

MorphTo
morphEagerTo(string $name, string $type, string $id, $ownerKey)

Define a polymorphic, inverse one-to-one or many relationship.

MorphTo
morphInstanceTo(string $target, string $name, string $type, string $id, $ownerKey)

Define a polymorphic, inverse one-to-one or many relationship.

MorphMany
morphMany(string $related, string $name, string|null $type = null, string|null $id = null, string|null $localKey = null, null $relationName = null)

Define a polymorphic one-to-many relationship.

morphToMany(string $related, string $name, string|null $table = null, string|null $foreignPivotKey = null, string|null $relatedPivotKey = null, string|null $parentKey = null, string|null $relatedKey = null, bool $inverse = false, null $relationName = null)

Define a polymorphic many-to-many relationship.

morphedByMany(string $related, string $name, string|null $table = null, string|null $foreignPivotKey = null, string|null $relatedPivotKey = null, string|null $parentKey = null, string|null $relatedKey = null, null $relationName = null)

Define a polymorphic, inverse many-to-many relationship.

__construct(array $attributes = [])

No description

from  Model
static Model|Model
make(array $attributes = [])

Create a new model and return the instance.

from  Model
static Model|Model
create(array $attributes = [], string $sessionKey = null)

Save a new model and return the instance.

from  Model
Model|Model
reload()

Reloads the model attributes from the database.

from  Model
void
reloadRelations(string $relationName = null)

Reloads the model relationship cache.

from  Model
static 
extend(Closure $callback)

Extend this object properties upon construction.

from  Model
bootNicerEvents()

Bind some nicer events to this model, in the format of method overrides.

from  Model
static void
flushEventListeners()

Remove all of the event listeners for the model Also flush registry of models that had events booted Allows painless unit testing.

from  Model
Model|Model
newFromBuilder(array $attributes = [], null $connection = null)

Create a new model instance that is existing.

from  Model
beforeCreate()

Handle the "creating" model event

afterCreate()

Handle the "created" model event

from  Model
beforeUpdate()

Handle the "updating" model event

from  Model
afterUpdate()

Handle the "updated" model event

from  Model
beforeSave()

Handle the "saving" model event

from  Model
afterSave()

Handle the "saved" model event

from  Model
beforeDelete()

Handle the "deleting" model event

from  Model
afterDelete()

Handle the "deleted" model event

from  Model
beforeFetch()

Handle the "fetching" model event

from  Model
afterFetch()

Handle the "fetched" model event

from  Model
static void
fetching(Closure|string $callback)

Create a new native event for handling beforeFetch().

from  Model
static void
fetched(Closure|string $callback)

Create a new native event for handling afterFetch().

from  Model
setUpdatedAt($value)

No description

from  Model
setCreatedAt($value)

No description

from  Model
array
getObservableEvents()

Get the observable event names.

from  Model
isRelationPurgeable($name)

No description

from  Model
newEloquentBuilder(Builder $query)

Create a new Eloquent query builder for the model.

from  Model
string
getForeignKey()

Get the default foreign key name for the model.

from  Model
__get($key)

No description

from  Model
__set($name, $value)

No description

from  Model
mixed
__call(string $method, $params)

Handle dynamic method calls into the model.

from  Model
newPivot(Model $parent, array $attributes, string $table, bool $exists, string|null $using = null)

Create a generic pivot model instance.

from  Model
newRelationPivot(string $relationName, Model $parent, array $attributes, string $table, bool $exists)

Create a pivot model instance specific to a relation.

from  Model
bool
saveInternal(array $options = [])

Save the model to the database. Is used by save()

from  Model
bool
save(array $options = null, null $sessionKey = null)

Save the model to the database.

from  Model
bool
push(array $options = null, null $sessionKey = null)

Save the model and all of its relationships.

from  Model
bool
alwaysPush(array $options = null, string $sessionKey = null)

Pushes the first level of relations even if the parent model has no changes.

from  Model
void
performDeleteOnModel()

Perform the actual delete query on this model instance.

from  Model
void
performDeleteOnRelations()

Locates relations with delete flag and cascades the delete event.

from  Model
static 
bootHasInvoice()

No description

getInvoiceNumberAttribute()

No description

getInvoiceNoAttribute()

No description

hasInvoice()

No description

generateInvoice()

No description

generateInvoicePrefix($invoiceDate = null)

No description

static 
bootManagesOrderItems()

No description

void
subtractStock()

Subtract cart item quantity from menu stock quantity

Collection
getOrderMenus()

Return all order menu by order_id

Collection
getOrderMenuOptions()

Return all order menu options by order_id

Collection
getOrderMenusWithOptions()

Return all order menus merged with order menu options

Collection
getOrderTotals()

Return all order totals by order_id

float
addOrderMenus(array $content)

Add cart menu items to order by order_id

bool
addOrderMenuOptions($orderMenuId, $menuId, $options)

Add cart menu item options to menu and order by, order_id and menu_id

bool
addOrderTotals(array $totals = [])

Add cart totals to order by order_id

addOrUpdateOrderTotal(array $total)

No description

calculateTotals()

No description

orderMenusQuery()

No description

orderMenuOptionsQuery()

No description

orderTotalsQuery()

No description

static 
bootLogsStatusHistory()

No description

addStatusHistory($status, array $statusData = [])

No description

hasStatus($statusId = null)

No description

scopeWhereStatus($query, $statusId)

No description

scopeWhereHasStatusInHistory($query, $statusId)

No description

mailGetRecipients($type)

No description

array
mailGetData()

Return the order data to build mail template

mailSend($view, $recipientType = null)

No description

mailBuildMessage($recipientType = null)

No description

static void
bootLocationable()

Boot the locationable trait for a model.

locationableScopeEnabled()

No description

scopeWhereHasLocation($query, $locationId)

No description

scopeWhereHasOrDoesntHaveLocation($query, $locationId)

No description

applyLocationScope(Builder $builder, Model|array|int $userLocation)

Apply the Location scope query.

detachLocationsOnDelete()

No description

locationableRelationName()

No description

locationableRelationExists()

No description

static 
bootAssignable()

No description

performOnAssignableAssigned()

No description

bool
assignTo(Staffs_model $assignee)

No description

bool
assignToGroup(Staff_groups_model $group)

No description

updateAssignTo($group = null, $assignee = null)

No description

isAssignedToStaffGroup($staff)

No description

hasAssignTo()

No description

hasAssignToGroup()

No description

listGroupAssignees()

No description

mixed
scopeFilterAssignedTo(Builder $query, null $assignedTo = null)

No description

mixed
scopeWhereUnAssigned(Builder $query)

No description

mixed
scopeWhereAssignTo(Builder $query, $assigneeId)

No description

mixed
scopeWhereAssignToGroup(Builder $query, $assigneeGroupId)

No description

mixed
scopeWhereInAssignToGroup(Builder $query, array $assigneeGroupIds)

No description

mixed
scopeWhereHasAutoAssignGroup(Builder $query)

No description

listCustomerAddresses()

No description

scopeListFrontEnd($query, $options = [])

No description

scopeWhereBetweenOrderDateTime($query, $start, $end)

No description

getCustomerNameAttribute($value)

No description

getOrderTypeNameAttribute()

No description

getOrderDatetimeAttribute($value)

No description

getFormattedAddressAttribute($value)

No description

isCompleted()

No description

bool
isPaymentProcessed()

Check if an order was successfully placed

isDeliveryType()

No description

isCollectionType()

No description

array
getOrderDates()

Return the dates of all orders

markAsPaymentProcessed()

No description

logPaymentAttempt($message, $isSuccess, $request = [], $response = [], $isRefundable = FALSE)

No description

updateOrderStatus($id, $options = [])

No description

string
generateHash()

Generate a unique hash for this order.

string
createHash()

Create a hash for this order.

Details

in ExtendableTrait at line 55
extendableConstruct()

Constructor.

in ExtendableTrait at line 103
static void extendableExtendCallback(callable $callback)

Helper method for ::extend() static method

Parameters

callable $callback

Return Value

void

in ExtendableTrait at line 120
static void clearExtendedClasses()

Clear the list of extended classes so they will be re-extended.

Return Value

void

in ExtendableTrait at line 131
protected string extensionNormalizeClassName(string $name)

Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes

Parameters

string $name

Return Value

string

in ExtendableTrait at line 149
void|ExtendableTrait extendClassWith(string $extensionName)

Dynamically extend a class with a specified behavior

Parameters

string $extensionName

Return Value

void|ExtendableTrait

Exceptions

Exception

in ExtendableTrait at line 178
protected void extensionExtractMethods(string $extensionName, object $extensionObject)

Extracts the available methods from a behavior and adds it to the list of callable methods.

Parameters

string $extensionName
object $extensionObject

Return Value

void

in ExtendableTrait at line 206
addDynamicMethod(string $dynamicName, callable $method, string $extension = null)

Programmatically adds a method to the extendable class

Parameters

string $dynamicName
callable $method
string $extension

in ExtendableTrait at line 225
addDynamicProperty(string $dynamicName, string $value = null)

Programatically adds a property to the extendable class

Parameters

string $dynamicName
string $value

in ExtendableTrait at line 249
bool isClassExtendedWith(string $name)

Check if extendable class is extended with a behavior object

Parameters

string $name

Fully qualified behavior name

Return Value

bool

in ExtendableTrait at line 265
mixed getClassExtension(string $name)

Returns a behavior object from an extendable class, example:

$this->getClassExtension('Admin.Actions.FormController')

Parameters

string $name

Fully qualified behavior name

Return Value

mixed

in ExtendableTrait at line 280
mixed asExtension(string $shortName)

Short hand for getClassExtension() method, except takes the short extension name, example:

$this->asExtension('FormController')

Parameters

string $shortName

Return Value

mixed

in ExtendableTrait at line 301
bool methodExists(string $name)

Checks if a method exists, extension equivalent of method_exists()

Parameters

string $name

Return Value

bool

in ExtendableTrait at line 313
array getClassMethods()

Get a list of class methods, extension equivalent of get_class_methods()

Return Value

array

in ExtendableTrait at line 326
array getDynamicProperties()

Returns all dynamic properties and their values

Return Value

array

['property' => 'value']

in ExtendableTrait at line 344
bool propertyExists(string $name)

Checks if a property exists, extension equivalent of property_exists()

Parameters

string $name

Return Value

bool

in ExtendableTrait at line 370
protected bool extendableIsAccessible(mixed $class, string $propertyName)

Checks if a property is accessible, property equivalent of is_callabe()

Parameters

mixed $class
string $propertyName

Return Value

bool

in ExtendableTrait at line 385
string extendableGet(string $name)

Magic method for __get()

Parameters

string $name

Return Value

string

in ExtendableTrait at line 410
string extendableSet(string $name, string $value)

Magic method for __set()

Parameters

string $name
string $value

Return Value

string

in ExtendableTrait at line 444
mixed extendableCall(string $name, array $params = null)

Magic method for __call()

Parameters

string $name
array $params

Return Value

mixed

in ExtendableTrait at line 483
static mixed extendableCallStatic(string $name, array $params = null)

Magic method for __callStatic()

Parameters

string $name
array $params

Return Value

mixed

in ExtendableTrait at line 552
protected ClassLoader|null extensionGetClassLoader()

Gets the class loader

Return Value

ClassLoader|null

in EventEmitter at line 36
EventEmitter bindEvent(string $event, callable $callback, int $priority = 0)

Create a new event binding.

Parameters

string $event

The event name to listen for

callable $callback

The callback to call when emitted

int $priority

Return Value

EventEmitter

in EventEmitter at line 52
EventEmitter bindEventOnce(string $event, callable $callback)

Create a new event binding that fires once only

Parameters

string $event

The event name

callable $callback

Return Value

EventEmitter

in EventEmitter at line 66
protected void emitterEventSortEvents(string $eventName)

Sort the listeners for a given event by priority.

Parameters

string $eventName

Return Value

void

in EventEmitter at line 84
EventEmitter unbindEvent(string $event = null)

Destroys an event binding.

Parameters

string $event

Event to destroy

Return Value

EventEmitter

in EventEmitter at line 124
string|array fireEvent(string $event, array $params = [], bool $halt = false)

Fire an event and call the listeners.

Parameters

string $event

Event name

array $params

Event parameters

bool $halt

Halt after first non-null result

Return Value

string|array

Collection of event results / Or single result (if halted)

in EventEmitter at line 178
mixed fireSystemEvent(string $event, array $params = [], bool $halt = true)

Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.

For example:

$this->fireSystemEvent('admin.form.myEvent', ['my value']);

Is equivalent to:

$this->fireEvent('form.myEvent', ['myvalue'], true);

Event::fire('admin.form.myEvent', [$this, 'myvalue'], true);

Parameters

string $event

Event name

array $params

Event parameters

bool $halt

Halt after first non-null result

Return Value

mixed

in HasAttributes at line 19
void addCasts(array $attributes)

Add attribute casts for the model.

Parameters

array $attributes

Return Value

void

in HasAttributes at line 24
getAttribute($key)

No description

Parameters

$key

in HasAttributes at line 46
getAttributeValue($key)

No description

Parameters

$key

in HasAttributes at line 65
attributesToArray()

No description

in HasAttributes at line 111
HasAttributes setAttribute(string $key, mixed $value)

Set a given attribute on the model.

Parameters

string $key
mixed $value

Return Value

HasAttributes

in HasAttributes at line 170
protected asSerialized($value)

No description

Parameters

$value

in HasAttributes at line 175
fromSerialized($value)

No description

Parameters

$value

in HasAttributes at line 180
protected isSerializedCastable($key)

No description

Parameters

$key

in HasAttributes at line 185
protected asDateTime($value)

No description

Parameters

$value

in HasAttributes at line 197
protected asTime($value)

No description

Parameters

$value

in HasAttributes at line 242
string fromTime(Carbon|int $value)

Convert a Carbon Time to a storable string.

Parameters

Carbon|int $value

Return Value

string

in HasAttributes at line 259
protected bool isTimeCastable(string $key)

Determine whether a value is Time castable for inbound manipulation.

Parameters

string $key

Return Value

bool

in HasAttributes at line 268
protected string getTimeFormat()

Get the format for database stored times.

Return Value

string

in HasAttributes at line 280
HasAttributes setTimeFormat(string $format)

Set the time format used by the model.

Parameters

string $format

Return Value

HasAttributes

in HasRelationships at line 58
hasRelation($name)

No description

Parameters

$name

in HasRelationships at line 70
array getRelationDefinition(string $name)

Returns relationship details from a supplied name.

Parameters

string $name

Relation name

Return Value

array

in HasRelationships at line 81
array getRelationDefinitions()

Returns relationship details for all relations defined on this model.

Return Value

array

in HasRelationships at line 108
string getRelationType(string $name)

Returns a relationship type based on a supplied name.

Parameters

string $name

Relation name

Return Value

string

in HasRelationships at line 124
mixed getRelationValue(string $key)

Get a relationship.

Parameters

string $key

Return Value

mixed

in HasRelationships at line 141
protected $this setRelationValue($relationName, $value)

Sets a relation value directly from its attribute.

Parameters

$relationName
$value

Return Value

$this

in HasRelationships at line 155
string makeRelation(string $name)

Returns a relation class object

Parameters

string $name

Relation name

Return Value

string

in HasRelationships at line 177
bool isRelationPushable(string $name)

Determines whether the specified relation should be saved when push() is called instead of save() on the model. Default: true.

Parameters

string $name

Relation name

Return Value

bool

in HasRelationships at line 194
protected array getRelationDefaults(string $type)

Returns default relation arguments for a given type.

Parameters

string $type

Relation type

Return Value

array

in HasRelationships at line 206
handleRelation($relationName)

No description

Parameters

$relationName

in HasRelationships at line 334
protected array validateRelationArgs($relationName, $optional, array $required = [])

Validate relation supplied arguments.

Parameters

$relationName
$optional
array $required

Return Value

array

in HasRelationships at line 374
HasOne hasOne(string $related, string|null $foreignKey = null, string|null $localKey = null, null $relationName = null)

Define a one-to-one relationship.

Parameters

string $related
string|null $foreignKey
string|null $localKey
null $relationName

Return Value

HasOne

in HasRelationships at line 398
HasOneThrough hasOneThrough($related, $through, $primaryKey = null, $throughKey = null, $localKey = null, $secondLocalKey = null, $relationName = null)

Define a has-one-through relationship.

This code is a duplicate of Eloquent but uses a Rain relation class.

Parameters

$related
$through
$primaryKey
$throughKey
$localKey
$secondLocalKey
$relationName

Return Value

HasOneThrough

in HasRelationships at line 428
HasMany hasMany(string $related, string|null $foreignKey = null, string|null $localKey = null, null $relationName = null)

Define a one-to-many relationship.

Parameters

string $related
string|null $foreignKey
string|null $localKey
null $relationName

Return Value

HasMany

in HasRelationships at line 459
HasManyThrough hasManyThrough(string $related, string $through, string|null $firstKey = null, string|null $secondKey = null, string|null $localKey = null, string|null $secondLocalKey = null, null $relationName = null)

Define a has-many-through relationship.

Parameters

string $related
string $through
string|null $firstKey
string|null $secondKey
string|null $localKey
string|null $secondLocalKey
null $relationName

Return Value

HasManyThrough

in HasRelationships at line 487
belongsTo($related, $foreignKey = null, $ownerKey = null, $relationName = null)

No description

Parameters

$related
$foreignKey
$ownerKey
$relationName

in HasRelationships at line 508
belongsToMany($related, $table = null, $foreignPivotKey = null, $relatedPivotKey = null, $parentKey = null, $relatedKey = null, $relationName = null)

No description

Parameters

$related
$table
$foreignPivotKey
$relatedPivotKey
$parentKey
$relatedKey
$relationName

in HasRelationships at line 541
MorphOne morphOne(string $related, string $name, string|null $type = null, string|null $id = null, string|null $localKey = null, null $relationName = null)

Define a polymorphic one-to-one relationship.

Parameters

string $related
string $name
string|null $type
string|null $id
string|null $localKey
null $relationName

Return Value

MorphOne

in HasRelationships at line 572
protected MorphTo morphEagerTo(string $name, string $type, string $id, $ownerKey)

Define a polymorphic, inverse one-to-one or many relationship.

Parameters

string $name
string $type
string $id
$ownerKey

Return Value

MorphTo

in HasRelationships at line 594
protected MorphTo morphInstanceTo(string $target, string $name, string $type, string $id, $ownerKey)

Define a polymorphic, inverse one-to-one or many relationship.

Parameters

string $target
string $name
string $type
string $id
$ownerKey

Return Value

MorphTo

in HasRelationships at line 621
MorphMany morphMany(string $related, string $name, string|null $type = null, string|null $id = null, string|null $localKey = null, null $relationName = null)

Define a polymorphic one-to-many relationship.

Parameters

string $related
string $name
string|null $type
string|null $id
string|null $localKey
null $relationName

Return Value

MorphMany

in HasRelationships at line 657
MorphToMany morphToMany(string $related, string $name, string|null $table = null, string|null $foreignPivotKey = null, string|null $relatedPivotKey = null, string|null $parentKey = null, string|null $relatedKey = null, bool $inverse = false, null $relationName = null)

Define a polymorphic many-to-many relationship.

Parameters

string $related
string $name
string|null $table
string|null $foreignPivotKey
string|null $relatedPivotKey
string|null $parentKey
string|null $relatedKey
bool $inverse
null $relationName

Return Value

MorphToMany

in HasRelationships at line 705
MorphToMany morphedByMany(string $related, string $name, string|null $table = null, string|null $foreignPivotKey = null, string|null $relatedPivotKey = null, string|null $parentKey = null, string|null $relatedKey = null, null $relationName = null)

Define a polymorphic, inverse many-to-many relationship.

Parameters

string $related
string $name
string|null $table
string|null $foreignPivotKey
string|null $relatedPivotKey
string|null $parentKey
string|null $relatedKey
null $relationName

Return Value

MorphToMany

in Model at line 88
__construct(array $attributes = [])

No description

Parameters

array $attributes

in Model at line 103
static Model|Model make(array $attributes = [])

Create a new model and return the instance.

Parameters

array $attributes

Return Value

Model|Model

in Model at line 117
static Model|Model create(array $attributes = [], string $sessionKey = null)

Save a new model and return the instance.

Parameters

array $attributes
string $sessionKey

Return Value

Model|Model

Exceptions

Exception

in Model at line 129
Model|Model reload()

Reloads the model attributes from the database.

Return Value

Model|Model

in Model at line 148
void reloadRelations(string $relationName = null)

Reloads the model relationship cache.

Parameters

string $relationName

Return Value

void

in Model at line 163
static extend(Closure $callback)

Extend this object properties upon construction.

Parameters

Closure $callback

in Model at line 171
protected bootNicerEvents()

Bind some nicer events to this model, in the format of method overrides.

in Model at line 214
static void flushEventListeners()

Remove all of the event listeners for the model Also flush registry of models that had events booted Allows painless unit testing.

Return Value

void

in Model at line 229
Model|Model newFromBuilder(array $attributes = [], null $connection = null)

Create a new model instance that is existing.

Parameters

array $attributes
null $connection

Return Value

Model|Model

at line 101
protected beforeCreate()

Handle the "creating" model event

in Model at line 255
protected afterCreate()

Handle the "created" model event

in Model at line 262
protected beforeUpdate()

Handle the "updating" model event

in Model at line 269
protected afterUpdate()

Handle the "updated" model event

in Model at line 276
protected beforeSave()

Handle the "saving" model event

in Model at line 283
protected afterSave()

Handle the "saved" model event

in Model at line 290
protected beforeDelete()

Handle the "deleting" model event

in Model at line 297
protected afterDelete()

Handle the "deleted" model event

in Model at line 304
protected beforeFetch()

Handle the "fetching" model event

in Model at line 311
protected afterFetch()

Handle the "fetched" model event

in Model at line 322
static void fetching(Closure|string $callback)

Create a new native event for handling beforeFetch().

Parameters

Closure|string $callback

Return Value

void

in Model at line 334
static void fetched(Closure|string $callback)

Create a new native event for handling afterFetch().

Parameters

Closure|string $callback

Return Value

void

in Model at line 339
setUpdatedAt($value)

No description

Parameters

$value

in Model at line 347
setCreatedAt($value)

No description

Parameters

$value

in Model at line 363
array getObservableEvents()

Get the observable event names.

Return Value

array

in Model at line 375
protected isRelationPurgeable($name)

No description

Parameters

$name

in Model at line 391
Builder newEloquentBuilder(Builder $query)

Create a new Eloquent query builder for the model.

Parameters

Builder $query

Return Value

Builder

in Model at line 400
string getForeignKey()

Get the default foreign key name for the model.

Return Value

string

in Model at line 409
__get($key)

No description

Parameters

$key

in Model at line 414
__set($name, $value)

No description

Parameters

$name
$value

in Model at line 427
mixed __call(string $method, $params)

Handle dynamic method calls into the model.

Parameters

string $method
$params

Return Value

mixed

in Model at line 448
Pivot newPivot(Model $parent, array $attributes, string $table, bool $exists, string|null $using = null)

Create a generic pivot model instance.

Parameters

Model $parent
array $attributes
string $table
bool $exists
string|null $using

Return Value

Pivot

in Model at line 464
Pivot newRelationPivot(string $relationName, Model $parent, array $attributes, string $table, bool $exists)

Create a pivot model instance specific to a relation.

Parameters

string $relationName
Model $parent
array $attributes
string $table
bool $exists

Return Value

Pivot

in Model at line 487
protected bool saveInternal(array $options = [])

Save the model to the database. Is used by save()

Parameters

array $options

Return Value

bool

Exceptions

Exception

in Model at line 521
bool save(array $options = null, null $sessionKey = null)

Save the model to the database.

Parameters

array $options
null $sessionKey

Return Value

bool

Exceptions

Exception

in Model at line 535
bool push(array $options = null, null $sessionKey = null)

Save the model and all of its relationships.

Parameters

array $options
null $sessionKey

Return Value

bool

Exceptions

Exception

in Model at line 577
bool alwaysPush(array $options = null, string $sessionKey = null)

Pushes the first level of relations even if the parent model has no changes.

Parameters

array $options
string $sessionKey

Return Value

bool

in Model at line 586
protected void performDeleteOnModel()

Perform the actual delete query on this model instance.

Return Value

void

in Model at line 596
protected void performDeleteOnRelations()

Locates relations with delete flag and cascades the delete event.

Return Value

void

in HasInvoice at line 9
static bootHasInvoice()

No description

in HasInvoice at line 21
getInvoiceNumberAttribute()

No description

in HasInvoice at line 29
getInvoiceNoAttribute()

No description

in HasInvoice at line 37
hasInvoice()

No description

in HasInvoice at line 42
generateInvoice()

No description

in HasInvoice at line 62
generateInvoicePrefix($invoiceDate = null)

No description

Parameters

$invoiceDate

in ManagesOrderItems at line 13
static bootManagesOrderItems()

No description

in ManagesOrderItems at line 20
protected handleOnBeforePaymentProcessed()

No description

in ManagesOrderItems at line 30
void subtractStock()

Subtract cart item quantity from menu stock quantity

Return Value

void

in ManagesOrderItems at line 61
Collection getOrderMenus()

Return all order menu by order_id

Return Value

Collection

in ManagesOrderItems at line 71
Collection getOrderMenuOptions()

Return all order menu options by order_id

Return Value

Collection

in ManagesOrderItems at line 81
Collection getOrderMenusWithOptions()

Return all order menus merged with order menu options

Return Value

Collection

in ManagesOrderItems at line 113
Collection getOrderTotals()

Return all order totals by order_id

Return Value

Collection

in ManagesOrderItems at line 125
float addOrderMenus(array $content)

Add cart menu items to order by order_id

Parameters

array $content

Return Value

float

in ManagesOrderItems at line 164
protected bool addOrderMenuOptions($orderMenuId, $menuId, $options)

Add cart menu item options to menu and order by, order_id and menu_id

Parameters

$orderMenuId
$menuId
$options

Return Value

bool

in ManagesOrderItems at line 193
bool addOrderTotals(array $totals = [])

Add cart totals to order by order_id

Parameters

array $totals

Return Value

bool

in ManagesOrderItems at line 206
addOrUpdateOrderTotal(array $total)

No description

Parameters

array $total

in ManagesOrderItems at line 214
calculateTotals()

No description

in ManagesOrderItems at line 247
orderMenusQuery()

No description

in ManagesOrderItems at line 252
orderMenuOptionsQuery()

No description

in ManagesOrderItems at line 257
orderTotalsQuery()

No description

in LogsStatusHistory at line 12
static bootLogsStatusHistory()

No description

in LogsStatusHistory at line 29
getStatusNameAttribute()

No description

in LogsStatusHistory at line 34
getStatusColorAttribute()

No description

in LogsStatusHistory at line 39
getLatestStatusHistory()

No description

in LogsStatusHistory at line 44
addStatusHistory($status, array $statusData = [])

No description

Parameters

$status
array $statusData

in LogsStatusHistory at line 70
hasStatus($statusId = null)

No description

Parameters

$statusId

in LogsStatusHistory at line 78
scopeWhereStatus($query, $statusId)

No description

Parameters

$query
$statusId

in LogsStatusHistory at line 83
scopeWhereHasStatusInHistory($query, $statusId)

No description

Parameters

$query
$statusId

at line 320
mailGetRecipients($type)

No description

Parameters

$type

at line 348
array mailGetData()

Return the order data to build mail template

Return Value

array

in SendsMailTemplate at line 19
mailSend($view, $recipientType = null)

No description

Parameters

$view
$recipientType

in SendsMailTemplate at line 30
protected mailBuildMessage($recipientType = null)

No description

Parameters

$recipientType

in Locationable at line 27
static void bootLocationable()

Boot the locationable trait for a model.

Return Value

void

in Locationable at line 34
locationableScopeEnabled()

No description

in Locationable at line 42
locationableGetUserLocation()

No description

in Locationable at line 51
scopeWhereHasLocation($query, $locationId)

No description

Parameters

$query
$locationId

in Locationable at line 56
scopeWhereHasOrDoesntHaveLocation($query, $locationId)

No description

Parameters

$query
$locationId

in Locationable at line 68
protected applyLocationScope(Builder $builder, Model|array|int $userLocation)

Apply the Location scope query.

Parameters

Builder $builder
Model|array|int $userLocation

in Locationable at line 96
protected detachLocationsOnDelete()

No description

in Locationable at line 114
protected getLocationableRelationObject()

No description

in Locationable at line 121
locationableIsSingleRelationType()

No description

in Locationable at line 128
locationableRelationName()

No description

in Locationable at line 133
locationableRelationExists()

No description

in Assignable at line 12
static bootAssignable()

No description

in Assignable at line 33
protected performOnAssignableAssigned()

No description

in Assignable at line 49
bool assignTo(Staffs_model $assignee)

No description

Parameters

Staffs_model $assignee

Return Value

bool

in Assignable at line 61
bool assignToGroup(Staff_groups_model $group)

No description

Parameters

Staff_groups_model $group

Return Value

bool

in Assignable at line 66
updateAssignTo($group = null, $assignee = null)

No description

Parameters

$group
$assignee

in Assignable at line 89
isAssignedToStaffGroup($staff)

No description

Parameters

$staff

in Assignable at line 97
hasAssignTo()

No description

in Assignable at line 102
hasAssignToGroup()

No description

in Assignable at line 107
listGroupAssignees()

No description

in Assignable at line 124
mixed scopeFilterAssignedTo(Builder $query, null $assignedTo = null)

No description

Parameters

Builder $query
null $assignedTo

Return Value

mixed

in Assignable at line 140
mixed scopeWhereUnAssigned(Builder $query)

No description

Parameters

Builder $query

Return Value

mixed

in Assignable at line 150
mixed scopeWhereAssignTo(Builder $query, $assigneeId)

No description

Parameters

Builder $query
$assigneeId

Return Value

mixed

in Assignable at line 160
mixed scopeWhereAssignToGroup(Builder $query, $assigneeGroupId)

No description

Parameters

Builder $query
$assigneeGroupId

Return Value

mixed

in Assignable at line 170
mixed scopeWhereInAssignToGroup(Builder $query, array $assigneeGroupIds)

No description

Parameters

Builder $query
array $assigneeGroupIds

Return Value

mixed

in Assignable at line 179
mixed scopeWhereHasAutoAssignGroup(Builder $query)

No description

Parameters

Builder $query

Return Value

mixed

at line 89
listCustomerAddresses()

No description

at line 113
scopeListFrontEnd($query, $options = [])

No description

Parameters

$query
$options

at line 182
scopeWhereBetweenOrderDateTime($query, $start, $end)

No description

Parameters

$query
$start
$end

at line 193
getCustomerNameAttribute($value)

No description

Parameters

$value

at line 198
getOrderTypeNameAttribute()

No description

at line 208
getOrderDatetimeAttribute($value)

No description

Parameters

$value

at line 218
getFormattedAddressAttribute($value)

No description

Parameters

$value

at line 227
isCompleted()

No description

at line 244
bool isPaymentProcessed()

Check if an order was successfully placed

Return Value

bool

TRUE on success, or FALSE on failure

at line 249
isDeliveryType()

No description

at line 254
isCollectionType()

No description

at line 264
array getOrderDates()

Return the dates of all orders

Return Value

array

at line 269
markAsPaymentProcessed()

No description

at line 281
logPaymentAttempt($message, $isSuccess, $request = [], $response = [], $isRefundable = FALSE)

No description

Parameters

$message
$isSuccess
$request
$response
$isRefundable

at line 286
updateOrderStatus($id, $options = [])

No description

Parameters

$id
$options

at line 299
protected string generateHash()

Generate a unique hash for this order.

Return Value

string

at line 311
protected string createHash()

Create a hash for this order.

Return Value

string