Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Sep 21, 2017
1 parent 5a5c598 commit 66c5e46
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions src/Illuminate/Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,19 @@ protected function mergeGroupAttributesIntoRoute($route)
$route->setAction($this->mergeWithLastGroup($route->getAction()));
}

/**
* Return the response returned by the given route.
*
* @param string $name
* @return mixed
*/
public function respondWithRoute($name)
{
$route = tap($this->routes->getByName($name))->bind($this->currentRequest);

return $this->runRoute($this->currentRequest, $route);
}

/**
* Dispatch the request to the application.
*
Expand All @@ -572,7 +585,7 @@ public function dispatch(Request $request)
*/
public function dispatchToRoute(Request $request)
{
return $this->buildResponse($request, $this->findRoute($request));
return $this->runRoute($request, $this->findRoute($request));
}

/**
Expand All @@ -597,7 +610,7 @@ protected function findRoute($request)
* @param Request $request
* @return mixed
*/
protected function buildResponse(Request $request, Route $route)
protected function runRoute(Request $request, Route $route)
{
$request->setRouteResolver(function () use ($route) {
return $route;
Expand Down Expand Up @@ -1109,19 +1122,6 @@ public function auth()
$this->post('password/reset', 'Auth\ResetPasswordController@reset');
}

/**
* Return a response out of the given route.
*
* @param string $name
* @return mixed
*/
public function respondWith($name)
{
return $this->buildResponse($this->currentRequest,
tap($this->routes->getByName($name))->bind($this->currentRequest)
);
}

/**
* Set the unmapped global resource parameters to singular.
*
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Routing/FallbackRouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function test_respond_with_named_fallback_route()
})->name('testFallbackRoute');

Route::get('one', function () {
return Route::respondWith('testFallbackRoute');
return Route::respondWithRoute('testFallbackRoute');
});

$this->assertContains('fallback', $this->get('/non-existing')->getContent());
Expand Down

0 comments on commit 66c5e46

Please sign in to comment.