HasRoutes Trait

Aurora\Router Namespace


Properties

routes

Routes array

protected $routes = []: array

Methods

add

Add a new route

Parameters

  • string $slug — Route slug
  • mixed $handler — Route handler
  • mixed $method — HTTP method
  • bool $insert — Whether to insert the route or add it at the end

Return Value

  • \Route

Signature

protected function add(string $slug, mixed $handler, mixed $method = '*', bool $insert): Aurora\Router\Route

remove

Delete a route

Parameters

  • string $slug — Route slug

Return Value

  • $this

Signature

public function remove(string $slug)

clear

Remove all routes

Return Value

  • $this

Signature

public function clear()

getRoutes

Get all the routes

Return Value

  • array

Signature

public function getRoutes()

get

Add a new GET route

Parameters

  • string $slug — Route slug
  • mixed $handler — Route handler
  • bool $insert — Whether to insert the route or add it at the end

Return Value

  • \Route

Signature

public function get(string $slug, mixed $handler, bool $insert): Aurora\Router\Route

post

Add a new POST route

Parameters

  • string $slug — Route slug
  • mixed $handler — Route handler
  • bool $insert — Whether to insert the route or add it at the end

Return Value

  • \Route

Signature

public function post(string $slug, mixed $handler, bool $insert): Aurora\Router\Route

put

Add a new PUT route

Parameters

  • string $slug — Route slug
  • mixed $handler — Route handler
  • bool $insert — Whether to insert the route or add it at the end

Return Value

  • \Route

Signature

public function put(string $slug, mixed $handler, bool $insert): Aurora\Router\Route

patch

Add a new PATCH route

Parameters

  • string $slug — Route slug
  • mixed $handler — Route handler
  • bool $insert — Whether to insert the route or add it at the end

Return Value

  • \Route

Signature

public function patch(string $slug, mixed $handler, bool $insert): Aurora\Router\Route

delete

Add a new DELETE route

Parameters

  • string $slug — Route slug
  • mixed $handler — Route handler
  • bool $insert — Whether to insert the route or add it at the end

Return Value

  • \Route

Signature

public function delete(string $slug, mixed $handler, bool $insert): Aurora\Router\Route

options

Add a new OPTIONS route

Parameters

  • string $slug — Route slug
  • mixed $handler — Route handler
  • bool $insert — Whether to insert the route or add it at the end

Return Value

  • \Route

Signature

public function options(string $slug, mixed $handler, bool $insert): Aurora\Router\Route

all

Add a new route for all HTTP methods

Parameters

  • string $slug — Route slug
  • mixed $handler — Route handler
  • bool $insert — Whether to insert the route or add it at the end

Return Value

  • \Route

Signature

public function all(string $slug, mixed $handler, bool $insert): Aurora\Router\Route

match

Add a new route

Parameters

  • mixed $methods — HTTP methods array
  • string $slug — Route slug
  • mixed $handler — Route handler
  • bool $insert — Whether to insert the route or add it at the end

Return Value

  • \Route

Signature

public function match(mixed $methods, string $slug, mixed $handler, bool $insert): Aurora\Router\Route

view

Parameters

  • mixed $slug
  • mixed $template
  • mixed $data
  • mixed $insert

Signature

public function view(mixed $slug, mixed $template, mixed $data, mixed $insert)

resource

Add a resource route

Parameters

  • mixed $slug — Resource slug
  • mixed $handler — Controller that will handle all the HTTP methods

Return Value

  • $this

Signature

public function resource(mixed $slug, mixed $handler)

Go to top