Skip to content

Commit

Permalink
🐛 Route helper GET/POST/etc methods now return the Router
Browse files Browse the repository at this point in the history
  • Loading branch information
carbontwelve committed Apr 5, 2018
1 parent fe9c5aa commit e0ef6c0
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/App.php
Expand Up @@ -107,65 +107,71 @@ public function register(AbstractServiceProvider $serviceProvider)
*
* @param $route
* @param $action
* @return \League\Route\Route
*/
public function get($route, $action)
{
$this->getRouter()->map('GET', $route, $action);
return $this->getRouter()->map('GET', $route, $action);
}

/**
* Add a POST route.
*
* @param $route
* @param $action
* @return \League\Route\Route
*/
public function post($route, $action)
{
$this->getRouter()->map('POST', $route, $action);
return $this->getRouter()->map('POST', $route, $action);
}

/**
* Add a PUT route.
*
* @param $route
* @param $action
* @return \League\Route\Route
*/
public function put($route, $action)
{
$this->getRouter()->map('PUT', $route, $action);
return $this->getRouter()->map('PUT', $route, $action);
}

/**
* Add a DELETE route.
*
* @param $route
* @param $action
* @return \League\Route\Route
*/
public function delete($route, $action)
{
$this->getRouter()->map('DELETE', $route, $action);
return $this->getRouter()->map('DELETE', $route, $action);
}

/**
* Add a PATCH route.
*
* @param $route
* @param $action
* @return \League\Route\Route
*/
public function patch($route, $action)
{
$this->getRouter()->map('PATCH', $route, $action);
return $this->getRouter()->map('PATCH', $route, $action);
}

/**
* Add a OPTIONS route.
*
* @param $route
* @param $action
* @return \League\Route\Route
*/
public function options($route, $action)
{
$this->getRouter()->map('OPTIONS', $route, $action);
return $this->getRouter()->map('OPTIONS', $route, $action);
}

/**
Expand Down

0 comments on commit e0ef6c0

Please sign in to comment.