Controller traits
This commit is contained in:
12
common/Define/Controller/Redirect.php
Normal file
12
common/Define/Controller/Redirect.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace ProVM\Common\Define\Controller;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
|
||||
trait Redirect {
|
||||
public function withRedirect(Response $request, string $uri, int $status = 301): Response {
|
||||
return $response
|
||||
->withHeader('Location', $uri)
|
||||
->withStatus($status);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user