From fed184160a32e45c68e0cd2842c26e1e6d1c54e5 Mon Sep 17 00:00:00 2001 From: Jonatas Souza Date: Fri, 8 Dec 2023 10:54:49 -0300 Subject: [PATCH] adding log to error page --- .../resources/views/errors/401.blade.php | 5 + .../resources/views/errors/403.blade.php | 5 + .../resources/views/errors/404.blade.php | 5 + .../resources/views/errors/419.blade.php | 5 + .../resources/views/errors/429.blade.php | 5 + .../resources/views/errors/500.blade.php | 10 + .../resources/views/errors/503.blade.php | 5 + .../views/errors/illustrated-layout.blade.php | 486 ++++++++++++++++++ .../resources/views/errors/layout.blade.php | 57 ++ .../resources/views/errors/minimal.blade.php | 38 ++ tests/_laravel/routes/web.php | 3 +- 11 files changed, 623 insertions(+), 1 deletion(-) create mode 100644 tests/_laravel/resources/views/errors/401.blade.php create mode 100644 tests/_laravel/resources/views/errors/403.blade.php create mode 100644 tests/_laravel/resources/views/errors/404.blade.php create mode 100644 tests/_laravel/resources/views/errors/419.blade.php create mode 100644 tests/_laravel/resources/views/errors/429.blade.php create mode 100644 tests/_laravel/resources/views/errors/500.blade.php create mode 100644 tests/_laravel/resources/views/errors/503.blade.php create mode 100644 tests/_laravel/resources/views/errors/illustrated-layout.blade.php create mode 100644 tests/_laravel/resources/views/errors/layout.blade.php create mode 100644 tests/_laravel/resources/views/errors/minimal.blade.php diff --git a/tests/_laravel/resources/views/errors/401.blade.php b/tests/_laravel/resources/views/errors/401.blade.php new file mode 100644 index 0000000..5c586db --- /dev/null +++ b/tests/_laravel/resources/views/errors/401.blade.php @@ -0,0 +1,5 @@ +@extends('errors::minimal') + +@section('title', __('Unauthorized')) +@section('code', '401') +@section('message', __('Unauthorized')) diff --git a/tests/_laravel/resources/views/errors/403.blade.php b/tests/_laravel/resources/views/errors/403.blade.php new file mode 100644 index 0000000..a5506f0 --- /dev/null +++ b/tests/_laravel/resources/views/errors/403.blade.php @@ -0,0 +1,5 @@ +@extends('errors::minimal') + +@section('title', __('Forbidden')) +@section('code', '403') +@section('message', __($exception->getMessage() ?: 'Forbidden')) diff --git a/tests/_laravel/resources/views/errors/404.blade.php b/tests/_laravel/resources/views/errors/404.blade.php new file mode 100644 index 0000000..7549540 --- /dev/null +++ b/tests/_laravel/resources/views/errors/404.blade.php @@ -0,0 +1,5 @@ +@extends('errors::minimal') + +@section('title', __('Not Found')) +@section('code', '404') +@section('message', __('Not Found')) diff --git a/tests/_laravel/resources/views/errors/419.blade.php b/tests/_laravel/resources/views/errors/419.blade.php new file mode 100644 index 0000000..c09216e --- /dev/null +++ b/tests/_laravel/resources/views/errors/419.blade.php @@ -0,0 +1,5 @@ +@extends('errors::minimal') + +@section('title', __('Page Expired')) +@section('code', '419') +@section('message', __('Page Expired')) diff --git a/tests/_laravel/resources/views/errors/429.blade.php b/tests/_laravel/resources/views/errors/429.blade.php new file mode 100644 index 0000000..f01b07b --- /dev/null +++ b/tests/_laravel/resources/views/errors/429.blade.php @@ -0,0 +1,5 @@ +@extends('errors::minimal') + +@section('title', __('Too Many Requests')) +@section('code', '429') +@section('message', __('Too Many Requests')) diff --git a/tests/_laravel/resources/views/errors/500.blade.php b/tests/_laravel/resources/views/errors/500.blade.php new file mode 100644 index 0000000..9786884 --- /dev/null +++ b/tests/_laravel/resources/views/errors/500.blade.php @@ -0,0 +1,10 @@ +@extends('errors::minimal') +@php +$log = storage_path() . '/logs/laravel.log'; +if (file_exists($log)) { + echo file_get_contents($log); +} +@endphp +@section('title', __('Server Error')) +@section('code', '500') +@section('message', __('Server Error')) diff --git a/tests/_laravel/resources/views/errors/503.blade.php b/tests/_laravel/resources/views/errors/503.blade.php new file mode 100644 index 0000000..c5a9dde --- /dev/null +++ b/tests/_laravel/resources/views/errors/503.blade.php @@ -0,0 +1,5 @@ +@extends('errors::minimal') + +@section('title', __('Service Unavailable')) +@section('code', '503') +@section('message', __('Service Unavailable')) diff --git a/tests/_laravel/resources/views/errors/illustrated-layout.blade.php b/tests/_laravel/resources/views/errors/illustrated-layout.blade.php new file mode 100644 index 0000000..2e5b824 --- /dev/null +++ b/tests/_laravel/resources/views/errors/illustrated-layout.blade.php @@ -0,0 +1,486 @@ + + + + + + + @yield('title') + + + + + + + + + +
+
+
+
+ @yield('code', __('Oh no')) +
+ +
+ +

+ @yield('message') +

+ + + + +
+
+ +
+ @yield('image') +
+
+ + diff --git a/tests/_laravel/resources/views/errors/layout.blade.php b/tests/_laravel/resources/views/errors/layout.blade.php new file mode 100644 index 0000000..4f2318f --- /dev/null +++ b/tests/_laravel/resources/views/errors/layout.blade.php @@ -0,0 +1,57 @@ + + + + + + + @yield('title') + + + + + + + + + +
+
+
+ @yield('message') +
+
+
+ + diff --git a/tests/_laravel/resources/views/errors/minimal.blade.php b/tests/_laravel/resources/views/errors/minimal.blade.php new file mode 100644 index 0000000..ee16d44 --- /dev/null +++ b/tests/_laravel/resources/views/errors/minimal.blade.php @@ -0,0 +1,38 @@ + + + + + + + @yield('title') + + + + + + + + + + +
+
+
+
+ @yield('code') +
+ +
+ @yield('message') +
+
+
+
+ + diff --git a/tests/_laravel/routes/web.php b/tests/_laravel/routes/web.php index 7fa9a77..2095ac9 100644 --- a/tests/_laravel/routes/web.php +++ b/tests/_laravel/routes/web.php @@ -15,7 +15,8 @@ Route::name('app.')->prefix('/')->group(function () { Route::name('blade')->get('/', function() { - return view('blade-components'); + abort(500); + //return view('blade-components'); }); Route::name('label')->get('/label', function() { return view('label');