From f06ce731bfa895fe1d7c55f7534b35d38db0ebd3 Mon Sep 17 00:00:00 2001
From: mwalbeck <magn3200@gmail.com>
Date: Fri, 28 Oct 2016 13:06:29 +0200
Subject: [PATCH] added 3 error pages with common layout base

---
 app/Http/Controllers/PageController.php | 15 ++++++++
 resources/views/errors/403.blade.php    | 46 +++----------------------
 resources/views/errors/404.blade.php    |  9 +++++
 resources/views/errors/503.blade.php    | 46 +++----------------------
 resources/views/layouts/error.blade.php | 45 ++++++++++++++++++++++++
 routes/web.php                          |  3 ++
 6 files changed, 80 insertions(+), 84 deletions(-)
 create mode 100644 resources/views/errors/404.blade.php
 create mode 100644 resources/views/layouts/error.blade.php

diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php
index 355fdcc..85fa910 100644
--- a/app/Http/Controllers/PageController.php
+++ b/app/Http/Controllers/PageController.php
@@ -12,4 +12,19 @@ class PageController extends Controller
     {
         return view('welcome');
     }
+
+    public function error403()
+    {
+        return view('errors.403');
+    }
+
+    public function error404()
+    {
+        return view("errors.404");
+    }
+
+    public function error503()
+    {
+        return view("errors.503");
+    }
 }
diff --git a/resources/views/errors/403.blade.php b/resources/views/errors/403.blade.php
index eb76d26..f95d795 100644
--- a/resources/views/errors/403.blade.php
+++ b/resources/views/errors/403.blade.php
@@ -1,47 +1,9 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <title>Be right back.</title>
+@extends("layouts.error")
 
-        <link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
-
-        <style>
-            html, body {
-                height: 100%;
-            }
-
-            body {
-                margin: 0;
-                padding: 0;
-                width: 100%;
-                color: #B0BEC5;
-                display: table;
-                font-weight: 100;
-                font-family: 'Lato', sans-serif;
-            }
-
-            .container {
-                text-align: center;
-                display: table-cell;
-                vertical-align: middle;
-            }
-
-            .content {
-                text-align: center;
-                display: inline-block;
-            }
-
-            .title {
-                font-size: 72px;
-                margin-bottom: 40px;
-            }
-        </style>
-    </head>
-    <body>
+@section('content')
         <div class="container">
             <div class="content">
-                <div class="title">Be right back.</div>
+                <div class="title">403 - Not Authorized</div>
             </div>
         </div>
-    </body>
-</html>
+@endsection
diff --git a/resources/views/errors/404.blade.php b/resources/views/errors/404.blade.php
new file mode 100644
index 0000000..c25fa56
--- /dev/null
+++ b/resources/views/errors/404.blade.php
@@ -0,0 +1,9 @@
+@extends("layouts.error")
+
+@section('content')
+        <div class="container">
+            <div class="content">
+                <div class="title">404 - Not Found</div>
+            </div>
+        </div>
+@endsection
\ No newline at end of file
diff --git a/resources/views/errors/503.blade.php b/resources/views/errors/503.blade.php
index eb76d26..35443b1 100644
--- a/resources/views/errors/503.blade.php
+++ b/resources/views/errors/503.blade.php
@@ -1,47 +1,9 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <title>Be right back.</title>
+@extends("layouts.error")
 
-        <link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
-
-        <style>
-            html, body {
-                height: 100%;
-            }
-
-            body {
-                margin: 0;
-                padding: 0;
-                width: 100%;
-                color: #B0BEC5;
-                display: table;
-                font-weight: 100;
-                font-family: 'Lato', sans-serif;
-            }
-
-            .container {
-                text-align: center;
-                display: table-cell;
-                vertical-align: middle;
-            }
-
-            .content {
-                text-align: center;
-                display: inline-block;
-            }
-
-            .title {
-                font-size: 72px;
-                margin-bottom: 40px;
-            }
-        </style>
-    </head>
-    <body>
+@section('content')
         <div class="container">
             <div class="content">
-                <div class="title">Be right back.</div>
+                <div class="title">Be Right Back.</div>
             </div>
         </div>
-    </body>
-</html>
+@endsection
\ No newline at end of file
diff --git a/resources/views/layouts/error.blade.php b/resources/views/layouts/error.blade.php
new file mode 100644
index 0000000..a83df1b
--- /dev/null
+++ b/resources/views/layouts/error.blade.php
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Be right back.</title>
+
+        <link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
+
+        <style>
+            html, body {
+                height: 100%;
+            }
+
+            body {
+                margin: 0;
+                padding: 0;
+                width: 100%;
+                color: #B0BEC5;
+                display: table;
+                font-weight: 100;
+                font-family: 'Lato', sans-serif;
+            }
+
+            .container {
+                text-align: center;
+                display: table-cell;
+                vertical-align: middle;
+            }
+
+            .content {
+                text-align: center;
+                display: inline-block;
+            }
+
+            .title {
+                font-size: 72px;
+                margin-bottom: 40px;
+            }
+        </style>
+    </head>
+    <body>
+
+        @yield("content")
+        
+    </body>
+</html>
\ No newline at end of file
diff --git a/routes/web.php b/routes/web.php
index c8190af..f827118 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -12,6 +12,9 @@
 */
 
 Route::get('/', 'PageController@welcome');
+Route::get('/403', 'PageController@error403');
+Route::get('/404', 'PageController@error404');
+Route::get('/503', 'PageController@error503');
 
 Auth::routes();