diff --git a/src/Illuminate/Routing/Redirector.php b/src/Illuminate/Routing/Redirector.php index 99e7c226985d..3a5b50392165 100755 --- a/src/Illuminate/Routing/Redirector.php +++ b/src/Illuminate/Routing/Redirector.php @@ -115,11 +115,13 @@ public function intended($default = '/', $status = 302, $headers = [], $secure = * Set the intended url. * * @param string $url - * @return void + * @return $this */ public function setIntendedUrl($url) { $this->session->put('url.intended', $url); + + return $this; } /** diff --git a/tests/Routing/RoutingRedirectorTest.php b/tests/Routing/RoutingRedirectorTest.php index ec86d0ab5e94..d8177dca303b 100644 --- a/tests/Routing/RoutingRedirectorTest.php +++ b/tests/Routing/RoutingRedirectorTest.php @@ -182,6 +182,7 @@ public function testItSetsValidIntendedUrl() { $this->session->shouldReceive('put')->once()->with('url.intended', 'http://foo.com/bar'); - $this->redirect->setIntendedUrl('http://foo.com/bar'); + $result = $this->redirect->setIntendedUrl('http://foo.com/bar'); + $this->assertInstanceOf(Redirector::class, $result); } }