Documentation

helpers.php

Table of Contents

abort()  : void
Throw an HttpException with the given data.
abort_if()  : void
Throw an HttpException with the given data if the given condition is true.
abort_unless()  : void
Throw an HttpException with the given data unless the given condition is true.
action()  : string
Generate the URL to a controller action.
app()  : mixed|Application
Get the available container instance.
app_path()  : string
Get the path to the application folder.
asset()  : string
Generate an asset path for the application.
auth()  : Factory|Guard|StatefulGuard
Get the available auth instance.
back()  : RedirectResponse
Create a new redirect response to the previous location.
base_path()  : string
Get the path to the base of the install.
bcrypt()  : string
Hash the given value.
broadcast()  : PendingBroadcast
Begin broadcasting an event.
cache()  : mixed|CacheManager
Get / set the specified cache value.
config()  : mixed|Repository
Get / set the specified configuration value.
config_path()  : string
Get the configuration path.
cookie()  : CookieJar|Cookie
Create a new cookie instance.
csrf_field()  : HtmlString
Generate a CSRF token form field.
csrf_token()  : string
Get the CSRF token value.
database_path()  : string
Get the database path.
decrypt()  : string
Decrypt the given value.
dispatch()  : PendingDispatch
Dispatch a job to its appropriate handler.
dispatch_now()  : mixed
Dispatch a command to its appropriate handler in the current process.
elixir()  : string
Get the path to a versioned Elixir file.
encrypt()  : string
Encrypt the given value.
event()  : array<string|int, mixed>|null
Dispatch an event and call the listeners.
factory()  : FactoryBuilder
Create a model factory builder for a given class, name, and amount.
info()  : void
Write some information to the log.
logger()  : Log|null
Log a debug message to the logs.
method_field()  : HtmlString
Generate a form field to spoof the HTTP verb used by forms.
mix()  : HtmlString
Get the path to a versioned Mix file.
now()  : Carbon
Create a new Carbon instance for the current time.
old()  : mixed
Retrieve an old input item.
policy()  : mixed
Get a policy instance for a given class.
public_path()  : string
Get the path to the public folder.
redirect()  : Redirector|RedirectResponse
Get an instance of the redirector.
report()  : void
Report an exception.
request()  : Request|string|array<string|int, mixed>
Get an instance of the current request or an input item from the request.
rescue()  : mixed
Catch a potential exception and return a default value.
resolve()  : mixed
Resolve a service from the container.
resource_path()  : string
Get the path to the resources folder.
response()  : Response|ResponseFactory
Return a new response from the application.
route()  : string
Generate the URL to a named route.
secure_asset()  : string
Generate an asset path for the application.
secure_url()  : string
Generate a HTTPS url for the application.
session()  : mixed|Store|SessionManager
Get / set the specified session value.
storage_path()  : string
Get the path to the storage folder.
today()  : Carbon
Create a new Carbon instance for the current date.
trans()  : Translator|string|array<string|int, mixed>|null
Translate the given message.
trans_choice()  : string
Translates the given message based on a count.
__()  : string|array<string|int, mixed>|null
Translate the given message.
url()  : UrlGenerator|string
Generate a url for the application.
validator()  : Validator
Create a new Validator instance.
view()  : View|Factory
Get the evaluated view contents for the given view.

Functions

abort()

Throw an HttpException with the given data.

abort(int $code[, string $message = '' ][, array<string|int, mixed> $headers = [] ]) : void
Parameters
$code : int
$message : string = ''
$headers : array<string|int, mixed> = []
Tags
throws
HttpException
throws
NotFoundHttpException
Return values
void

abort_if()

Throw an HttpException with the given data if the given condition is true.

abort_if(bool $boolean, int $code[, string $message = '' ][, array<string|int, mixed> $headers = [] ]) : void
Parameters
$boolean : bool
$code : int
$message : string = ''
$headers : array<string|int, mixed> = []
Tags
throws
HttpException
throws
NotFoundHttpException
Return values
void

abort_unless()

Throw an HttpException with the given data unless the given condition is true.

abort_unless(bool $boolean, int $code[, string $message = '' ][, array<string|int, mixed> $headers = [] ]) : void
Parameters
$boolean : bool
$code : int
$message : string = ''
$headers : array<string|int, mixed> = []
Tags
throws
HttpException
throws
NotFoundHttpException
Return values
void

action()

Generate the URL to a controller action.

action(string $name[, array<string|int, mixed> $parameters = [] ][, bool $absolute = true ]) : string
Parameters
$name : string
$parameters : array<string|int, mixed> = []
$absolute : bool = true
Return values
string

app()

Get the available container instance.

app([string $abstract = null ][, array<string|int, mixed> $parameters = [] ]) : mixed|Application
Parameters
$abstract : string = null
$parameters : array<string|int, mixed> = []
Return values
mixed|Application

app_path()

Get the path to the application folder.

app_path([string $path = '' ]) : string
Parameters
$path : string = ''
Return values
string

asset()

Generate an asset path for the application.

asset(string $path[, bool $secure = null ]) : string
Parameters
$path : string
$secure : bool = null
Return values
string

back()

Create a new redirect response to the previous location.

back([int $status = 302 ][, array<string|int, mixed> $headers = [] ][, mixed $fallback = false ]) : RedirectResponse
Parameters
$status : int = 302
$headers : array<string|int, mixed> = []
$fallback : mixed = false
Return values
RedirectResponse

base_path()

Get the path to the base of the install.

base_path([string $path = '' ]) : string
Parameters
$path : string = ''
Return values
string

bcrypt()

Hash the given value.

bcrypt(string $value[, array<string|int, mixed> $options = [] ]) : string
Parameters
$value : string
$options : array<string|int, mixed> = []
Return values
string

cache()

Get / set the specified cache value.

cache() : mixed|CacheManager

If an array is passed, we'll assume you want to put to the cache.

Tags
throws
Exception
Return values
mixed|CacheManager

config()

Get / set the specified configuration value.

config([array<string|int, mixed>|string $key = null ][, mixed $default = null ]) : mixed|Repository

If an array is passed as the key, we will assume you want to set an array of values.

Parameters
$key : array<string|int, mixed>|string = null
$default : mixed = null
Return values
mixed|Repository

config_path()

Get the configuration path.

config_path([string $path = '' ]) : string
Parameters
$path : string = ''
Return values
string

Create a new cookie instance.

cookie([string $name = null ][, string $value = null ], int $minutes[, string $path = null ][, string $domain = null ][, bool $secure = false ][, bool $httpOnly = true ][, bool $raw = false ][, string|null $sameSite = null ]) : CookieJar|Cookie
Parameters
$name : string = null
$value : string = null
$minutes : int
$path : string = null
$domain : string = null
$secure : bool = false
$httpOnly : bool = true
$raw : bool = false
$sameSite : string|null = null
Return values
CookieJar|Cookie

csrf_token()

Get the CSRF token value.

csrf_token() : string
Tags
throws
RuntimeException
Return values
string

database_path()

Get the database path.

database_path([string $path = '' ]) : string
Parameters
$path : string = ''
Return values
string

decrypt()

Decrypt the given value.

decrypt(string $value[, bool $unserialize = true ]) : string
Parameters
$value : string
$unserialize : bool = true
Return values
string

dispatch_now()

Dispatch a command to its appropriate handler in the current process.

dispatch_now(mixed $job[, mixed $handler = null ]) : mixed
Parameters
$job : mixed
$handler : mixed = null
Return values
mixed

elixir()

Get the path to a versioned Elixir file.

elixir(string $file[, string $buildDirectory = 'build' ]) : string
Parameters
$file : string
$buildDirectory : string = 'build'
Tags
throws
InvalidArgumentException
Return values
string

encrypt()

Encrypt the given value.

encrypt(mixed $value[, bool $serialize = true ]) : string
Parameters
$value : mixed
$serialize : bool = true
Return values
string

event()

Dispatch an event and call the listeners.

event(mixed ...$args) : array<string|int, mixed>|null
Parameters
$args : mixed
Return values
array<string|int, mixed>|null

info()

Write some information to the log.

info(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
$message : string
$context : array<string|int, mixed> = []
Return values
void

logger()

Log a debug message to the logs.

logger([string $message = null ][, array<string|int, mixed> $context = [] ]) : Log|null
Parameters
$message : string = null
$context : array<string|int, mixed> = []
Return values
Log|null

method_field()

Generate a form field to spoof the HTTP verb used by forms.

method_field(string $method) : HtmlString
Parameters
$method : string
Return values
HtmlString

mix()

Get the path to a versioned Mix file.

mix(string $path[, string $manifestDirectory = '' ]) : HtmlString
Parameters
$path : string
$manifestDirectory : string = ''
Tags
throws
Exception
Return values
HtmlString

now()

Create a new Carbon instance for the current time.

now([DateTimeZone|string|null $tz = null ]) : Carbon
Parameters
$tz : DateTimeZone|string|null = null
Return values
Carbon

old()

Retrieve an old input item.

old([string $key = null ][, mixed $default = null ]) : mixed
Parameters
$key : string = null
$default : mixed = null
Return values
mixed

policy()

Get a policy instance for a given class.

policy(object|string $class) : mixed
Parameters
$class : object|string
Tags
throws
InvalidArgumentException
Return values
mixed

public_path()

Get the path to the public folder.

public_path([string $path = '' ]) : string
Parameters
$path : string = ''
Return values
string

redirect()

Get an instance of the redirector.

redirect([string|null $to = null ][, int $status = 302 ][, array<string|int, mixed> $headers = [] ][, bool $secure = null ]) : Redirector|RedirectResponse
Parameters
$to : string|null = null
$status : int = 302
$headers : array<string|int, mixed> = []
$secure : bool = null
Return values
Redirector|RedirectResponse

report()

Report an exception.

report(Exception $exception) : void
Parameters
$exception : Exception
Return values
void

request()

Get an instance of the current request or an input item from the request.

request([array<string|int, mixed>|string $key = null ][, mixed $default = null ]) : Request|string|array<string|int, mixed>
Parameters
$key : array<string|int, mixed>|string = null
$default : mixed = null
Return values
Request|string|array<string|int, mixed>

rescue()

Catch a potential exception and return a default value.

rescue(callable $callback[, mixed $rescue = null ]) : mixed
Parameters
$callback : callable
$rescue : mixed = null
Return values
mixed

resolve()

Resolve a service from the container.

resolve(string $name) : mixed
Parameters
$name : string
Return values
mixed

resource_path()

Get the path to the resources folder.

resource_path([string $path = '' ]) : string
Parameters
$path : string = ''
Return values
string

response()

Return a new response from the application.

response([string $content = '' ][, int $status = 200 ][, array<string|int, mixed> $headers = [] ]) : Response|ResponseFactory
Parameters
$content : string = ''
$status : int = 200
$headers : array<string|int, mixed> = []
Return values
Response|ResponseFactory

route()

Generate the URL to a named route.

route(array<string|int, mixed>|string $name[, array<string|int, mixed> $parameters = [] ][, bool $absolute = true ]) : string
Parameters
$name : array<string|int, mixed>|string
$parameters : array<string|int, mixed> = []
$absolute : bool = true
Return values
string

secure_asset()

Generate an asset path for the application.

secure_asset(string $path) : string
Parameters
$path : string
Return values
string

secure_url()

Generate a HTTPS url for the application.

secure_url(string $path[, mixed $parameters = [] ]) : string
Parameters
$path : string
$parameters : mixed = []
Return values
string

session()

Get / set the specified session value.

session([array<string|int, mixed>|string $key = null ][, mixed $default = null ]) : mixed|Store|SessionManager

If an array is passed as the key, we will assume you want to set an array of values.

Parameters
$key : array<string|int, mixed>|string = null
$default : mixed = null
Return values
mixed|Store|SessionManager

storage_path()

Get the path to the storage folder.

storage_path([string $path = '' ]) : string
Parameters
$path : string = ''
Return values
string

today()

Create a new Carbon instance for the current date.

today([DateTimeZone|string|null $tz = null ]) : Carbon
Parameters
$tz : DateTimeZone|string|null = null
Return values
Carbon

trans()

Translate the given message.

trans([string $key = null ][, array<string|int, mixed> $replace = [] ][, string $locale = null ]) : Translator|string|array<string|int, mixed>|null
Parameters
$key : string = null
$replace : array<string|int, mixed> = []
$locale : string = null
Return values
Translator|string|array<string|int, mixed>|null

trans_choice()

Translates the given message based on a count.

trans_choice(string $key, int|array<string|int, mixed>|Countable $number[, array<string|int, mixed> $replace = [] ][, string $locale = null ]) : string
Parameters
$key : string
$number : int|array<string|int, mixed>|Countable
$replace : array<string|int, mixed> = []
$locale : string = null
Return values
string

__()

Translate the given message.

__(string $key[, array<string|int, mixed> $replace = [] ][, string $locale = null ]) : string|array<string|int, mixed>|null
Parameters
$key : string
$replace : array<string|int, mixed> = []
$locale : string = null
Return values
string|array<string|int, mixed>|null

url()

Generate a url for the application.

url([string $path = null ][, mixed $parameters = [] ][, bool $secure = null ]) : UrlGenerator|string
Parameters
$path : string = null
$parameters : mixed = []
$secure : bool = null
Return values
UrlGenerator|string

validator()

Create a new Validator instance.

validator([array<string|int, mixed> $data = [] ][, array<string|int, mixed> $rules = [] ][, array<string|int, mixed> $messages = [] ][, array<string|int, mixed> $customAttributes = [] ]) : Validator
Parameters
$data : array<string|int, mixed> = []
$rules : array<string|int, mixed> = []
$messages : array<string|int, mixed> = []
$customAttributes : array<string|int, mixed> = []
Return values
Validator

view()

Get the evaluated view contents for the given view.

view([string $view = null ][, array<string|int, mixed> $data = [] ][, array<string|int, mixed> $mergeData = [] ]) : View|Factory
Parameters
$view : string = null
$data : array<string|int, mixed> = []
$mergeData : array<string|int, mixed> = []
Return values
View|Factory

Search results