->redirect impl.
This commit is contained in:
parent
85a4fd478f
commit
e12ca4f023
1 changed files with 7 additions and 0 deletions
|
|
@ -65,6 +65,13 @@ abstract class AbstractController
|
|||
return $response->withHeader('Content-type', 'application/json');
|
||||
}
|
||||
|
||||
public function redirect(Response $response, string $url = "/", int $code = 302) : Response
|
||||
{
|
||||
$response = $response->withStatus($code);
|
||||
|
||||
return $response->withHeader("Location", $url);
|
||||
}
|
||||
|
||||
public function jsonResponseException(\Exception $e, Request $request, Response $response): Response
|
||||
{
|
||||
return $this->jsonResponse(
|
||||
|
|
|
|||
Loading…
Reference in a new issue