summaryrefslogtreecommitdiff
path: root/src/Http
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-10-25 18:53:05 +0200
committermsquare <msquare@notrademark.de>2019-06-12 10:24:02 +0200
commit6ed891fc0416e8025f929cf60a07b1020118b221 (patch)
tree17e6a0d312693838133cb8241320424b9c0fcd1e /src/Http
parent2e51fbff9d8472a0e98af39aff52d30f0b67706b (diff)
Added logout via AuthController
Diffstat (limited to 'src/Http')
-rw-r--r--src/Http/Response.php23
-rw-r--r--src/Http/UrlGeneratorServiceProvider.php1
2 files changed, 24 insertions, 0 deletions
diff --git a/src/Http/Response.php b/src/Http/Response.php
index 58cd7662..1a7c8209 100644
--- a/src/Http/Response.php
+++ b/src/Http/Response.php
@@ -121,4 +121,27 @@ class Response extends SymfonyResponse implements ResponseInterface
return $new;
}
+
+ /**
+ * Return an redirect instance
+ *
+ * This method retains the immutability of the message and returns
+ * an instance with the updated status and headers
+ *
+ * @param string $path
+ * @param int $status
+ * @param array $headers
+ * @return Response
+ */
+ public function redirectTo($path, $status = 302, $headers = [])
+ {
+ $response = $this->withStatus($status);
+ $response = $response->withHeader('location', $path);
+
+ foreach ($headers as $name => $value) {
+ $response = $response->withAddedHeader($name, $value);
+ }
+
+ return $response;
+ }
}
diff --git a/src/Http/UrlGeneratorServiceProvider.php b/src/Http/UrlGeneratorServiceProvider.php
index 9b9988aa..774e3e35 100644
--- a/src/Http/UrlGeneratorServiceProvider.php
+++ b/src/Http/UrlGeneratorServiceProvider.php
@@ -11,5 +11,6 @@ class UrlGeneratorServiceProvider extends ServiceProvider
$urlGenerator = $this->app->make(UrlGenerator::class);
$this->app->instance(UrlGenerator::class, $urlGenerator);
$this->app->instance('http.urlGenerator', $urlGenerator);
+ $this->app->bind(UrlGeneratorInterface::class, UrlGenerator::class);
}
}