Skip to content

Commit

Permalink
Start organizing router.
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 21, 2016
1 parent e942274 commit eecf6ec
Showing 1 changed file with 60 additions and 64 deletions.
124 changes: 60 additions & 64 deletions src/Illuminate/Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ public function __construct(Dispatcher $events, Container $container = null)
$this->events = $events;
$this->routes = new RouteCollection;
$this->container = $container ?: new Container;

$this->bind('_missing', function ($v) {
return explode('/', $v);
});
}

/**
Expand Down Expand Up @@ -228,39 +224,6 @@ public function match($methods, $uri, $action = null)
return $this->addRoute(array_map('strtoupper', (array) $methods), $uri, $action);
}

/**
* Set the unmapped global resource parameters to singular.
*
* @param bool $singular
* @return void
*/
public function singularResourceParameters($singular = true)
{
ResourceRegistrar::singularParameters($singular);
}

/**
* Set the global resource parameter mapping.
*
* @param array $parameters
* @return void
*/
public function resourceParameters(array $parameters = [])
{
ResourceRegistrar::setParameters($parameters);
}

/**
* Get or set the verbs used in the resource URIs.
*
* @param array $verbs
* @return array|null
*/
public function resourceVerbs(array $verbs = [])
{
return ResourceRegistrar::verbs($verbs);
}

/**
* Register an array of resource controllers.
*
Expand Down Expand Up @@ -293,29 +256,6 @@ public function resource($name, $controller, array $options = [])
$registrar->register($name, $controller, $options);
}

/**
* Register the typical authentication routes for an application.
*
* @return void
*/
public function auth()
{
// Authentication Routes...
$this->get('login', 'Auth\LoginController@showLoginForm')->name('login');
$this->post('login', 'Auth\LoginController@login');
$this->post('logout', 'Auth\LoginController@logout')->name('logout');

// Registration Routes...
$this->get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
$this->post('register', 'Auth\RegisterController@register');

// Password Reset Routes...
$this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm');
$this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
$this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm');
$this->post('password/reset', 'Auth\ResetPasswordController@reset');
}

/**
* Create a route group with shared attributes.
*
Expand Down Expand Up @@ -1096,6 +1036,16 @@ public function input($key, $default = null)
return $this->current()->parameter($key, $default);
}

/**
* Get the request currently being dispatched.
*
* @return \Illuminate\Http\Request
*/
public function getCurrentRequest()
{
return $this->currentRequest;
}

/**
* Get the currently dispatched route instance.
*
Expand Down Expand Up @@ -1208,13 +1158,59 @@ public function currentRouteUses($action)
}

/**
* Get the request currently being dispatched.
* Register the typical authentication routes for an application.
*
* @return \Illuminate\Http\Request
* @return void
*/
public function getCurrentRequest()
public function auth()
{
return $this->currentRequest;
// Authentication Routes...
$this->get('login', 'Auth\LoginController@showLoginForm')->name('login');
$this->post('login', 'Auth\LoginController@login');
$this->post('logout', 'Auth\LoginController@logout')->name('logout');

// Registration Routes...
$this->get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
$this->post('register', 'Auth\RegisterController@register');

// Password Reset Routes...
$this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm');
$this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
$this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm');
$this->post('password/reset', 'Auth\ResetPasswordController@reset');
}

/**
* Set the unmapped global resource parameters to singular.
*
* @param bool $singular
* @return void
*/
public function singularResourceParameters($singular = true)
{
ResourceRegistrar::singularParameters($singular);
}

/**
* Set the global resource parameter mapping.
*
* @param array $parameters
* @return void
*/
public function resourceParameters(array $parameters = [])
{
ResourceRegistrar::setParameters($parameters);
}

/**
* Get or set the verbs used in the resource URIs.
*
* @param array $verbs
* @return array|null
*/
public function resourceVerbs(array $verbs = [])
{
return ResourceRegistrar::verbs($verbs);
}

/**
Expand Down

0 comments on commit eecf6ec

Please sign in to comment.