From 2c41144c612b030b3ec22ed84c2c337ffda76be7 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Wed, 23 Aug 2017 09:23:48 -0500 Subject: [PATCH] look in skin folder for error files --- app/Exceptions/Handler.php | 19 +++++++++++++++++++ .../default}/errors/401.blade.php | 0 .../default}/errors/404.blade.php | 0 .../default}/errors/503.blade.php | 0 4 files changed, 19 insertions(+) rename resources/views/{ => layouts/default}/errors/401.blade.php (100%) rename resources/views/{ => layouts/default}/errors/404.blade.php (100%) rename resources/views/{ => layouts/default}/errors/503.blade.php (100%) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 20c80561..8b5988a8 100755 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -67,4 +67,23 @@ class Handler extends ExceptionHandler return redirect()->guest('login'); } + + /** + * Render the given HttpException. + */ + protected function renderHttpException(\Symfony\Component\HttpKernel\Exception\HttpException $e) + { + $status = $e->getStatusCode(); + view()->replaceNamespace('errors', [ + resource_path('views/layouts/' . config('phpvms.skin') . '/errors'), + resource_path('views/errors'), + __DIR__ . '/views', + ]); + + if (view()->exists("errors::{$status}")) { + return response()->view("errors::{$status}", ['exception' => $e], $status, $e->getHeaders()); + } else { + return $this->convertExceptionToResponse($e); + } + } } diff --git a/resources/views/errors/401.blade.php b/resources/views/layouts/default/errors/401.blade.php similarity index 100% rename from resources/views/errors/401.blade.php rename to resources/views/layouts/default/errors/401.blade.php diff --git a/resources/views/errors/404.blade.php b/resources/views/layouts/default/errors/404.blade.php similarity index 100% rename from resources/views/errors/404.blade.php rename to resources/views/layouts/default/errors/404.blade.php diff --git a/resources/views/errors/503.blade.php b/resources/views/layouts/default/errors/503.blade.php similarity index 100% rename from resources/views/errors/503.blade.php rename to resources/views/layouts/default/errors/503.blade.php