Skip to content

Commit

Permalink
Move HTTP default error pages into framework.
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 17, 2016
1 parent 730daa7 commit 855a8aa
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Illuminate/Foundation/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,13 @@ protected function renderHttpException(HttpException $e)
{
$status = $e->getStatusCode();

if (view()->exists("errors.{$status}")) {
return response()->view("errors.{$status}", ['exception' => $e], $status, $e->getHeaders());
view()->replaceNamespace('errors', [
resource_path('views/errors'),
__DIR__.'/views',
]);

if (view()->exists("errors::{$status}")) {

This comment has been minimized.

Copy link
@raphaelsaunier

raphaelsaunier Nov 27, 2017

Contributor

Is this :: notation described anywhere in the current documentation? If not, I'm happy to do a PR.

Related: #20953

This comment has been minimized.

Copy link
@brunogaspar

brunogaspar Nov 27, 2017

Contributor

@raphaelsaunier https://laravel.com/docs/5.5/packages#views should give all the information you need.

return response()->view("errors::{$status}", ['exception' => $e], $status, $e->getHeaders());
} else {
return $this->convertExceptionToResponse($e);
}
Expand Down
62 changes: 62 additions & 0 deletions src/Illuminate/Foundation/Exceptions/views/503.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Laravel</title>

This comment has been minimized.

Copy link
@kduma

kduma Dec 17, 2016

Contributor

What about {{ config('app.name') }} instead of hardcoding page title?
Or is it better to consider that accessing configuration when the application is down, is dangerous?


<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">

<!-- Styles -->
<style>
html, body {
background-color: #fff;
color: #636b6f;
font-family: 'Raleway', sans-serif;
font-weight: 100;
height: 100vh;
margin: 0;
}
.full-height {
height: 100vh;
}
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
.position-ref {
position: relative;
}
.top-right {
position: absolute;
right: 10px;
top: 18px;
}
.content {
text-align: center;
}
.title {
font-size: 84px;
}
</style>
</head>
<body>
<div class="flex-center position-ref full-height">
<div class="content">
<div class="title">
Be right back.
</div>
</div>
</div>
</body>
</html>

0 comments on commit 855a8aa

Please sign in to comment.