LSApplicationTrait
Trait for ConsoleApplication and LSYii_Application
Tags
Table of Contents
Properties
- $currentUserId : mixed
Methods
- createPublicUrl() : string
- Creates an absolute URL based on the given controller and action information.
- getCurrentUserId() : int|null
- get the current id of connected user, check if user exist before return for security
- getPublicBaseUrl() : string
- Returns the relative URL for the application while considering if a "publicurl" config parameter is set to a valid url
Properties
$currentUserId
private
mixed
$currentUserId
Methods
createPublicUrl()
Creates an absolute URL based on the given controller and action information.
public
createPublicUrl(string $route[, array<string|int, mixed> $params = array() ][, string $schema = '' ][, string $ampersand = '&' ]) : string
Parameters
- $route : string
-
the URL route. This should be in the format of 'ControllerID/ActionID'.
- $params : array<string|int, mixed> = array()
-
additional GET parameters (name=>value). Both the name and value will be URL-encoded.
- $schema : string = ''
-
schema to use (e.g. http, https). If empty, the schema used for the current request will be used.
- $ampersand : string = '&'
-
the token separating name-value pairs in the URL.
Return values
string —the constructed URL
getCurrentUserId()
get the current id of connected user, check if user exist before return for security
public
getCurrentUserId() : int|null
Return values
int|null —user id, 0 mean invalid user
getPublicBaseUrl()
Returns the relative URL for the application while considering if a "publicurl" config parameter is set to a valid url
public
getPublicBaseUrl([bool $absolute = false ]) : string
Parameters
- $absolute : bool = false
-
whether to return an absolute URL. Defaults to false, meaning returning a relative one.
Return values
string —the relative or the configured public URL for the application