class Location extends Manager

Traits

Adds event related features to any class.

Properties

protected array $emitterSingleEvents from  EventEmitter
protected array $emitterEvents from  EventEmitter
protected array $emitterEventSorted from  EventEmitter
protected $sessionKey
protected AbstractLocation $model from  Manager
protected $defaultLocation from  Manager
protected $locationModel
protected $loaded from  Manager
static protected $schedulesCache from  Manager
static protected Closure $locationSlugResolver

The route parameter resolver callback.

from  Manager
protected $listLocationsCache

Methods

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.

instance()

Helper to get the current location instance.

from  Manager
string
resolveLocationSlug()

Resolve the location slug from route parameter.

from  Manager
void
locationSlugResolver(Closure $resolver)

Set the location route parameter resolver callback.

from  Manager
mixed
getDefaultLocation()

No description

setDefaultLocation(string $defaultLocation)

No description

from  Manager
getDefault()

No description

from  Manager
current()

No description

setCurrent(LocationInterface $locationModel)

No description

from  Manager
getModel()

No description

from  Manager
setModel(LocationInterface $model)

No description

from  Manager
setModelById($id)

No description

from  Manager
setModelClass($className)

No description

from  Manager
createLocationModel()

Creates a new instance of the location model

from  Manager
createLocationModelQuery()

Prepares a query derived from the location model.

from  Manager
void
extendLocationQuery(Builder $query)

Extend the query used for finding the location.

from  Manager
getById(mixed $identifier)

Retrieve a location by their unique identifier.

from  Manager
getBySlug(string $slug)

Retrieve a location by their unique slug.

from  Manager
searchByCoordinates(CoordinatesInterface $coordinates, $limit = 20)

No description

from  Manager
workingSchedule($type, null $days = null)

No description

from  Manager
mixed
getSession(string $key = null, string $default = null)

Retrieves key/value pair from session data.

from  Manager
putSession($key, $value)

No description

from  Manager
forgetSession($key = null)

No description

from  Manager
check()

No description

clearCurrent()

No description

hasAccess($location)

No description

hasRestriction()

No description

isSingleMode()

No description

getId()

No description

getName()

No description

getAll()

No description

getIdOrAll()

No description

getLocation()

No description

listLocations()

No description

hasOneLocation()

No description

hasLocations()

No description

getLocations()

No description

getAuth()

No description

isAttachedToAuth($id)

No description

Details

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 Manager at line 44
Manager instance()

Helper to get the current location instance.

Return Value

Manager

in Manager at line 54
string resolveLocationSlug()

Resolve the location slug from route parameter.

Return Value

string

in Manager at line 67
void locationSlugResolver(Closure $resolver)

Set the location route parameter resolver callback.

Parameters

Closure $resolver

Return Value

void

at line 112
mixed getDefaultLocation()

No description

Return Value

mixed

in Manager at line 83
setDefaultLocation(string $defaultLocation)

No description

Parameters

string $defaultLocation

in Manager at line 88
getDefault()

No description

at line 20
current()

No description

in Manager at line 117
setCurrent(LocationInterface $locationModel)

No description

Parameters

LocationInterface $locationModel

in Manager at line 126
getModel()

No description

in Manager at line 135
setModel(LocationInterface $model)

No description

Parameters

LocationInterface $model

in Manager at line 142
setModelById($id)

No description

Parameters

$id

in Manager at line 149
setModelClass($className)

No description

Parameters

$className

in Manager at line 158
AbstractLocation createLocationModel()

Creates a new instance of the location model

Return Value

AbstractLocation

in Manager at line 169
protected createLocationModelQuery()

Prepares a query derived from the location model.

in Manager at line 185
void extendLocationQuery(Builder $query)

Extend the query used for finding the location.

Parameters

Builder $query

Return Value

void

in Manager at line 196
AbstractLocation|null getById(mixed $identifier)

Retrieve a location by their unique identifier.

Parameters

mixed $identifier

Return Value

AbstractLocation|null

in Manager at line 211
LocationInterface|null getBySlug(string $slug)

Retrieve a location by their unique slug.

Parameters

string $slug

Return Value

LocationInterface|null

in Manager at line 220
searchByCoordinates(CoordinatesInterface $coordinates, $limit = 20)

No description

Parameters

CoordinatesInterface $coordinates
$limit

in Manager at line 236
WorkingSchedule workingSchedule($type, null $days = null)

No description

Parameters

$type
null $days

Return Value

WorkingSchedule

in Manager at line 262
mixed getSession(string $key = null, string $default = null)

Retrieves key/value pair from session data.

Parameters

string $key

Unique key for the data store.

string $default

A default value to use when value is not found.

Return Value

mixed

in Manager at line 269
putSession($key, $value)

No description

Parameters

$key
$value

in Manager at line 277
forgetSession($key = null)

No description

Parameters

$key

at line 15
check()

No description

at line 46
clearCurrent()

No description

at line 51
hasAccess($location)

No description

Parameters

$location

at line 59
hasRestriction()

No description

at line 67
isSingleMode()

No description

at line 72
getId()

No description

at line 77
getName()

No description

at line 82
getAll()

No description

at line 90
getIdOrAll()

No description

at line 95
getLocation()

No description

at line 100
listLocations()

No description

at line 120
hasOneLocation()

No description

at line 128
hasLocations()

No description

at line 139
protected getLocations()

No description

at line 149
protected User getAuth()

No description

Return Value

User

at line 154
protected isAttachedToAuth($id)

No description

Parameters

$id