class Order extends ReactiveObject

Traits

Properties

protected array $hooks from  Hooks
protected Event[] $eventHandlers from  Events
protected array $timestamps from  Timestamps
protected array $attributes from  Accessors
array $modified from  Accessors
ReactiveObject|ItemCollection|null $parent from  ReactiveObject
protected $defaults
protected array $readOnlyAttributes from  ReactiveObject
protected string $defaultOrderByField Determines the default field to order the query by from  Queryable
protected string $defaultSortDirection Determines the default direction to order the query by from  Queryable
static $useCache
static $cacheBaseKey
static $cacheTTL
static $sessionKey
static protected $base_path
protected $triedReceivedBySession
protected $respectPublishingStatus
protected $relation
float $order_tax
float $order_cost
float $order_total
int $customer_id
string $customer_code
string $customer_mail
string $customer_phone
string $created
string $updated
bool $abandoned
bool $abandoned_reminder_sent
string $abandoned_reminder_mail
string $status
string $type
string $ip
string $user_agent

Methods

addHook(string $name, callable $callback = null)

No description

from  Hooks
void
performHook(string $name)

No description

from  Hooks
void
performHooks()

No description

from  Hooks
on(string $eventName, callable $handler = null)

Attaches an event handler for a given event

from  Events
addEvent(Event $event)

Attaches an Event directly

from  Events
void
emit(string $event, mixed $payload = null)

Emits an event to parent

from  Events
void
trigger(string $eventName, mixed $payload = null)

Invokes the event handlers for the given event

from  Events
serializeTimestamp($value)

No description

array
toArray()

Get the raw attributes

mixed
__get(string $property)

No description

__set(string $property, mixed $value)

No description

bool
__isset(string $property)

No description

__unset(string $key)

No description

bool
offsetExists(string $property)

No description

mixed
offsetGet(string $property)

No description

mixed
offsetSet(string $property, mixed $value)

No description

void
offsetUnset(string $key)

No description

string
__toString()

No description

__construct(object|array $attributes = [], object|null $parent = null)

No description

setParent(ReactiveObject|ItemCollection|null $parent)

No description

ReactiveObject|ItemCollection|null
getParent()

No description

ReactiveObject|ItemCollection|null
getRootParent()

No description

int
getIdAttribute(string|int $id = null)

No description

array
__debugInfo()

No description

static ReactiveObject
factory(object|array $attributes = [], object|null $parent = null)

No description

array
jsonSerialize()

No description

static 
hasTrait($trait)

No description

array
__serialize()

No description

__unserialize(array $data)

No description

addCart(array $item)

No description

addDiscount(array $item)

No description

addPayment(array $item)

No description

addData(string $key, string $value, string $label = '')

No description

addLogInfo(array|string $item)

No description

addLogWarning(array|string $item)

No description

addLogDanger(array|string $item)

No description

addLogSuccess(array|string $item)

No description

addLog(array|string $item, string $type = 'i')

No description

saveStatus($status)

No description

from  OrderAPI
save(array $payload = [])

No description

from  OrderAPI
refresh()

No description

from  OrderAPI
addToSession()

No description

from  OrderAPI
removeFromSession()

No description

from  OrderAPI
checkoutEnd(array $payload = [])

Same as checkout, but set checkout_end date in payload for you

from  OrderAPI
checkout(array $payload = [])

No description

from  OrderAPI
register()

No description

from  OrderAPI
lock()

Set order->status to "n" and checkout->checkout_end to now

from  OrderAPI
emptyCart()

No description

from  OrderAPI
delete()

No description

from  OrderAPI
static OrderAPI
create(array $order = [])

Creates empty order object based on orderData

from  OrderAPI
static OrderAPI
retrieveBySessionOrCreate(string|null $key = null)

If no session exist, it creates a new empty order in API with id and secret, and adds it to session.

from  OrderAPI
static OrderAPI
retrieveBySession(string|null $key = null)

If no session exist, it creates a new empty order object WITHOUT id or secret.

from  OrderAPI
static OrderAPI
retrieveBySecret(string $secret)

No description

from  OrderAPI
static OrderAPI
retrieveByRegisterId(string $id)

No description

from  OrderAPI
static OrderAPI
retrieve(string $id)

No description

from  OrderAPI
static array|null
getFromCache(string $key)

No description

from  OrderAPI
addToCache()

No description

from  OrderAPI
forgetInCache()

No description

from  OrderAPI
static Builder
makeQueryBuilder($appends = [])

No description

bool
respectPublishingStatus()

Determine if this object respects publishing statuses when performing queries

static Builder
disregardingPublishingStatus(bool $disregarding = true)

Override the publishing status for the model

static Builder
field(...$args)

Adds a field that should be retrieved

static Builder
fields(...$args)

Sets which fields to retrieve (default: All fields)

static Builder
limit(...$args)

Limits the results to $limit amount of hits

static Builder
orderBy(...$args)

Sets the field which to order the results by

static Builder
raw(...$args)

Performs a raw query, use carefully.

static Builder
publishedAt(...$args)

Performs a 'publishedAt' query

static Builder
where(...$args)

Performs a 'where' query

static Builder
whereIn(...$args)

Queries where field exists in the values

static Builder
whereNot(...$args)

Performs a 'whereNot' query

static 
whereBetween(...$args)

No description

static 
whereNotBetween(...$args)

No description

static Paginator
paginate(...$args)

Creates a paginated result

static mixed
maybeMutatesCache(string $key, bool $shouldCache, Closure $action)

Perform an action and mutate the given key if $shouldCache is true

static Builder
maybeCacheResults(string $key, bool $shouldCache)

Cache the results with the given key if $shouldCache is true

static Builder
cacheResults(string $key)

Cache the results with the given key

static int
count(...$args)

Get the count of items matching the current query

static Queryable|Collection
random(int $amount = 1)

Picks random items

static Builder
query(string $query = '*')

No description

string
getRelation()

Gets the relation

int|null
getRelationId()

Gets the relation_id

string
getCacheIdentifier(mixed $identifier = null)

Creates a cacheKey

getAllCacheIdentifier()

No description

getMapper()

No description

newFromBuilder(array $attributes = [])

No description

int|null
getCustomerIdAttribute(string|int $id)

No description

float
getOrderTaxAttribute(string|float|int $tax)

No description

float
getOrderCostAttribute(string|float|int $cost)

No description

float
getOrderTotalAttribute(string|float|int $total)

No description

bool
getAbandonedAttribute(string|int|bool|null $abandoned)

No description

bool
getAbandonedReminderSentAttribute(string|int|bool|null $sent)

No description

Register
getRegisterAttribute(object|array|null $register)

No description

Cart
getCartAttribute(object|array|null $cart = [])

No description

Data
getDataAttribute(object|array|null $data = [])

No description

Payments
getPaymentsAttribute(object|array|null $payments = null)

No description

Checkout
getCheckoutAttribute(object|array|null $checkout = null)

No description

DiscountItemCollection
getDiscountsAttribute(array|null $discounts = [])

No description

LogItemCollection
getLogAttribute(array|null $log = [])

No description

static string
dateTimeNow()

Return the current date and time, formatted as it is stored in the database

static string
basePath()

No description

Details

in Hooks at line 15
Hooks addHook(string $name, callable $callback = null)

Parameters

string $name
callable $callback

Return Value

Hooks

in Hooks at line 30
void performHook(string $name)

Parameters

string $name

Return Value

void

in Hooks at line 40
void performHooks()

Return Value

void

in Events at line 17
Events on(string $eventName, callable $handler = null)

Attaches an event handler for a given event

Parameters

string $eventName
callable $handler

Return Value

Events

in Events at line 30
Events addEvent(Event $event)

Attaches an Event directly

Parameters

Event $event

Return Value

Events

in Events at line 43
void emit(string $event, mixed $payload = null)

Emits an event to parent

Parameters

string $event
mixed $payload = null

Return Value

void

in Events at line 57
void trigger(string $eventName, mixed $payload = null)

Invokes the event handlers for the given event

Parameters

string $eventName
mixed $payload = null

Return Value

void

in Timestamps at line 18
serializeTimestamp($value)

Parameters

$value

in Accessors at line 30
array toArray()

Get the raw attributes

Return Value

array

in Accessors at line 39
mixed __get(string $property)

Parameters

string $property

Return Value

mixed

in Accessors at line 67
__set(string $property, mixed $value)

Parameters

string $property
mixed $value

in Accessors at line 97
bool __isset(string $property)

Parameters

string $property

Return Value

bool

in Accessors at line 105
__unset(string $key)

Parameters

string $key

in Accessors at line 116
bool offsetExists(string $property)

Parameters

string $property

Return Value

bool

in Accessors at line 127
mixed offsetGet(string $property)

Parameters

string $property

Return Value

mixed

in Accessors at line 137
mixed offsetSet(string $property, mixed $value)

Parameters

string $property
mixed $value

Return Value

mixed

in Accessors at line 146
void offsetUnset(string $key)

Parameters

string $key

Return Value

void

in Accessors at line 154
string __toString()

Return Value

string

in ReactiveObject at line 30
__construct(object|array $attributes = [], object|null $parent = null)

Parameters

object|array $attributes = []
object|null $parent = null

in ReactiveObject at line 53
ReactiveObject setParent(ReactiveObject|ItemCollection|null $parent)

Parameters

ReactiveObject|ItemCollection|null $parent

Return Value

ReactiveObject

in ReactiveObject at line 62
ReactiveObject|ItemCollection|null getParent()

Return Value

ReactiveObject|ItemCollection|null

in ReactiveObject at line 70
ReactiveObject|ItemCollection|null getRootParent()

Return Value

ReactiveObject|ItemCollection|null

in ReactiveObject at line 85
int getIdAttribute(string|int $id = null)

Parameters

string|int $id

Return Value

int

in ReactiveObject at line 93
array __debugInfo()

Return Value

array

in ReactiveObject at line 109
static ReactiveObject factory(object|array $attributes = [], object|null $parent = null)

Parameters

object|array $attributes = []
object|null $parent = null

Return Value

ReactiveObject

in ReactiveObject at line 117
array jsonSerialize()

Return Value

array

in ReactiveObject at line 142
static hasTrait($trait)

Parameters

$trait

in ReactiveObject at line 150
array __serialize()

Return Value

array

in ReactiveObject at line 158
__unserialize(array $data)

Parameters

array $data

in OrderAddAPI at line 15
OrderAddAPI addCart(array $item)

Parameters

array $item

Return Value

OrderAddAPI

Exceptions

Exception

in OrderAddAPI at line 31
OrderAddAPI addDiscount(array $item)

Parameters

array $item

Return Value

OrderAddAPI

Exceptions

Exception

in OrderAddAPI at line 47
OrderAddAPI addPayment(array $item)

Parameters

array $item

Return Value

OrderAddAPI

Exceptions

Exception

in OrderAddAPI at line 65
OrderAddAPI addData(string $key, string $value, string $label = '')

Parameters

string $key
string $value
string $label

Return Value

OrderAddAPI

Exceptions

Exception

in OrderAddAPI at line 90
OrderAddAPI addLogInfo(array|string $item)

Parameters

array|string $item

Return Value

OrderAddAPI

Exceptions

Exception

in OrderAddAPI at line 100
OrderAddAPI addLogWarning(array|string $item)

Parameters

array|string $item

Return Value

OrderAddAPI

Exceptions

Exception

in OrderAddAPI at line 110
OrderAddAPI addLogDanger(array|string $item)

Parameters

array|string $item

Return Value

OrderAddAPI

Exceptions

Exception

in OrderAddAPI at line 120
OrderAddAPI addLogSuccess(array|string $item)

Parameters

array|string $item

Return Value

OrderAddAPI

Exceptions

Exception

in OrderAddAPI at line 131
OrderAddAPI addLog(array|string $item, string $type = 'i')

Parameters

array|string $item
string $type

Return Value

OrderAddAPI

Exceptions

Exception

in OrderAPI at line 21
OrderAPI saveStatus($status)

Parameters

$status

Return Value

OrderAPI

Exceptions

Exception

in OrderAPI at line 31
OrderAPI save(array $payload = [])

Parameters

array $payload

Return Value

OrderAPI

Exceptions

Exception

in OrderAPI at line 64
OrderAPI refresh()

Return Value

OrderAPI

Exceptions

Exception

in OrderAPI at line 80
OrderAPI addToSession()

Return Value

OrderAPI

in OrderAPI at line 90
OrderAPI removeFromSession()

Return Value

OrderAPI

in OrderAPI at line 105
OrderAPI checkoutEnd(array $payload = [])

Same as checkout, but set checkout_end date in payload for you

Parameters

array $payload

Return Value

OrderAPI

Exceptions

Exception

in OrderAPI at line 117
OrderAPI checkout(array $payload = [])

Parameters

array $payload

Return Value

OrderAPI

Exceptions

Exception

in OrderAPI at line 128
OrderAPI register()

Return Value

OrderAPI

Exceptions

Exception

in OrderAPI at line 140
OrderAPI lock()

Set order->status to "n" and checkout->checkout_end to now

Return Value

OrderAPI

Exceptions

Exception

in OrderAPI at line 151
OrderAPI emptyCart()

Return Value

OrderAPI

Exceptions

Exception

in OrderAPI at line 162
OrderAPI delete()

Return Value

OrderAPI

Exceptions

Exception

in OrderAPI at line 176
static OrderAPI create(array $order = [])

Creates empty order object based on orderData

Parameters

array $order

Return Value

OrderAPI

Exceptions

Exception

in OrderAPI at line 190
static OrderAPI retrieveBySessionOrCreate(string|null $key = null)

If no session exist, it creates a new empty order in API with id and secret, and adds it to session.

Parameters

string|null $key

Return Value

OrderAPI

Exceptions

Exception

in OrderAPI at line 209
static OrderAPI retrieveBySession(string|null $key = null)

If no session exist, it creates a new empty order object WITHOUT id or secret.

But; It makes shure session is set when order is saved.

Parameters

string|null $key

Return Value

OrderAPI

Exceptions

Exception

in OrderAPI at line 240
static OrderAPI retrieveBySecret(string $secret)

Parameters

string $secret

Return Value

OrderAPI

Exceptions

OrderNotFoundException

in OrderAPI at line 260
static OrderAPI retrieveByRegisterId(string $id)

Parameters

string $id

Return Value

OrderAPI

Exceptions

OrderNotFoundException

in OrderAPI at line 278
static OrderAPI retrieve(string $id)

Parameters

string $id

Return Value

OrderAPI

Exceptions

OrderNotFoundException

in OrderAPI at line 297
static protected array|null getFromCache(string $key)

Parameters

string $key

Return Value

array|null

in OrderAPI at line 314
protected OrderAPI addToCache()

Return Value

OrderAPI

in OrderAPI at line 339
OrderAPI forgetInCache()

Return Value

OrderAPI

in Queryable at line 39
static protected Builder makeQueryBuilder($appends = [])

Parameters

$appends

Return Value

Builder

Exceptions

NotQueryableException If object not queryable

in Queryable at line 99
bool respectPublishingStatus()

Determine if this object respects publishing statuses when performing queries

Return Value

bool

in Queryable at line 111
static Builder disregardingPublishingStatus(bool $disregarding = true)

Override the publishing status for the model

Parameters

bool $disregarding

Return Value

Builder

in Queryable at line 125
static Builder field(...$args)

Adds a field that should be retrieved

Parameters

...$args

Return Value

Builder

Exceptions

NotQueryableException If object not queryable

See also

Builder::field

in Queryable at line 138
static Builder fields(...$args)

Sets which fields to retrieve (default: All fields)

Parameters

...$args

Return Value

Builder

Exceptions

NotQueryableException If object not queryable

See also

Builder::fields

in Queryable at line 151
static Builder limit(...$args)

Limits the results to $limit amount of hits

Parameters

...$args

Return Value

Builder

Exceptions

NotQueryableException If object not queryable

See also

Builder::limit

in Queryable at line 166
static Builder orderBy(...$args)

Sets the field which to order the results by

Parameters

...$args

Return Value

Builder

Exceptions

InvalidSortingDirectionException If an invalid $direction is passed
NotQueryableException If object not queryable

See also

Builder::orderBy

in Queryable at line 179
static Builder raw(...$args)

Performs a raw query, use carefully.

Parameters

...$args

Return Value

Builder

Exceptions

NotQueryableException If object not queryable

See also

Builder::raw

in Queryable at line 192
static Builder publishedAt(...$args)

Performs a 'publishedAt' query

Parameters

...$args

Return Value

Builder

Exceptions

NotQueryableException If object not queryable

See also

Builder::publishedAt

in Queryable at line 210
static Builder where(...$args)

Performs a 'where' query

If a closure is passed as the only argument, a new query scope will be created. If $value is omitted, $operator is used as the $value, and the $operator will be set to '='.

Parameters

...$args

Return Value

Builder

Exceptions

NotQueryableException If object not queryable

See also

Builder::where

in Queryable at line 224
static Builder whereIn(...$args)

Queries where field exists in the values

Parameters

...$args

Return Value

Builder

Exceptions

NotQueryableException If object not queryable

See also

Builder::whereIn

in Queryable at line 242
static Builder whereNot(...$args)

Performs a 'whereNot' query

If a closure is passed as the only argument, a new query scope will be created. If $value is omitted, $operator is used as the $value, and the $operator will be set to '='.

Parameters

...$args

Return Value

Builder

Exceptions

NotQueryableException If object not queryable

See also

Builder::whereNot

in Queryable at line 257
static whereBetween(...$args)

Parameters

...$args

in Queryable at line 272
static whereNotBetween(...$args)

Parameters

...$args

in Queryable at line 287
static Paginator paginate(...$args)

Creates a paginated result

Parameters

...$args

Return Value

Paginator

Exceptions

NotQueryableException If object not queryable
QueryException On invalid query

See also

Builder::paginate

in Queryable at line 303
static mixed maybeMutatesCache(string $key, bool $shouldCache, Closure $action)

Perform an action and mutate the given key if $shouldCache is true

Parameters

string $key
bool $shouldCache
Closure $action

Return Value

mixed

in Queryable at line 320
static Builder maybeCacheResults(string $key, bool $shouldCache)

Cache the results with the given key if $shouldCache is true

Parameters

string $key
bool $shouldCache

Return Value

Builder

See also

Builder::cacheResultsWithKey

in Queryable at line 336
static Builder cacheResults(string $key)

Cache the results with the given key

Parameters

string $key

Return Value

Builder

See also

Builder::cacheResultsWithKey

in Queryable at line 349
static int count(...$args)

Get the count of items matching the current query

Parameters

...$args

Return Value

int

Exceptions

NotQueryableException If object not queryable
QueryException On invalid query

See also

Builder::count

in Queryable at line 360
static Queryable|Collection random(int $amount = 1)

Picks random items

Parameters

int $amount

Return Value

Queryable|Collection

in Queryable at line 372
static Builder query(string $query = '*')

Parameters

string $query

Return Value

Builder

Exceptions

NotQueryableException

in HasRelation at line 15
string getRelation()

Gets the relation

Return Value

string

in HasRelation at line 26
int|null getRelationId()

Gets the relation_id

Return Value

int|null

in HasRelation at line 39
protected string getCacheIdentifier(mixed $identifier = null)

Creates a cacheKey

Parameters

mixed $identifier

Return Value

string

in HasRelation at line 56
protected getAllCacheIdentifier()

in ModelMapper at line 12
protected Closure getMapper()

Return Value

Closure

at line 93
Order newFromBuilder(array $attributes = [])

Parameters

array $attributes

Return Value

Order

at line 102
int|null getCustomerIdAttribute(string|int $id)

Parameters

string|int $id

Return Value

int|null

at line 111
float getOrderTaxAttribute(string|float|int $tax)

Parameters

string|float|int $tax

Return Value

float

at line 120
float getOrderCostAttribute(string|float|int $cost)

Parameters

string|float|int $cost

Return Value

float

at line 129
float getOrderTotalAttribute(string|float|int $total)

Parameters

string|float|int $total

Return Value

float

at line 138
bool getAbandonedAttribute(string|int|bool|null $abandoned)

Parameters

string|int|bool|null $abandoned

Return Value

bool

at line 147
bool getAbandonedReminderSentAttribute(string|int|bool|null $sent)

Parameters

string|int|bool|null $sent

Return Value

bool

at line 156
Register getRegisterAttribute(object|array|null $register)

Parameters

object|array|null $register

Return Value

Register

at line 165
Cart getCartAttribute(object|array|null $cart = [])

Parameters

object|array|null $cart

Return Value

Cart

at line 177
Data getDataAttribute(object|array|null $data = [])

Parameters

object|array|null $data

Return Value

Data

at line 189
Payments getPaymentsAttribute(object|array|null $payments = null)

Parameters

object|array|null $payments

Return Value

Payments

at line 201
Checkout getCheckoutAttribute(object|array|null $checkout = null)

Parameters

object|array|null $checkout

Return Value

Checkout

at line 213
DiscountItemCollection getDiscountsAttribute(array|null $discounts = [])

Parameters

array|null $discounts

Return Value

DiscountItemCollection

at line 225
LogItemCollection getLogAttribute(array|null $log = [])

Parameters

array|null $log

Return Value

LogItemCollection

at line 237
static string dateTimeNow()

Return the current date and time, formatted as it is stored in the database

Return Value

string

at line 245
static string basePath()

Return Value

string