Description
Core\Url url()
Using our url() function will give you access to our core url class, which is used to handle primarily the creation of links and sending users from one page to another.
Examples
<?php // Create a URL echo url()->make('/foo'); // Converts to http://localhost/foo // Sends a user to another route url()->send('/foo');
Methods
Method | Description | Usage | Returns |
---|---|---|---|
make(string $route [, array $params = []] )
$route URL route. $params (optional) Params can be passed, which will be converted
| Creates a new link. | // Create a URL echo url()->make('/foo'); // Converts to http://localhost/foo // Create a URL echo url()->make('/foo', ['hello' => 'world']); // Converts to http://localhost/foo?hello=world | Prepared link. |
send(string $route [, array $params = [], string $message = null])
$route Provide the segment number $params (optional) Params can be passed, which will be converted $message (optional) Message to display to the user once they have reached | Sends the user to the link.
| // Sends a user to another route url()->send('/foo'); // Sends a user to another route with GET params url()->send('/foo', ['hello' => 'world']); // Send a user to another route with a message url()->send('/foo', ['hello' => 'world'], 'Successfully Updated!'); // Send a user to another route with a message and without additional GET params url()->send('/foo', 'Successfully Updated!'); | null |