Page tree
Skip to end of metadata
Go to start of metadata

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


MethodDescriptionUsageReturns

make(string $route [, array $params = []] )

 


$route

URL route.


$params

(optional) Params can be passed, which will be converted
into GET requests. 

 

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
of the URL. 


$params

(optional) Params can be passed, which will be converted
into GET requests. 


$message

(optional) Message to display to the user once they have reached
the next page. 

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
  • No labels