diff --git a/app/Http/Controllers/HomepageController.php b/app/Http/Controllers/HomepageController.php index 41c04ad..a73357e 100644 --- a/app/Http/Controllers/HomepageController.php +++ b/app/Http/Controllers/HomepageController.php @@ -186,4 +186,8 @@ public function contact(){ return view('homepage.contacts.index', $data); } + + public function customError($code){ + abort($code); + } } diff --git a/app/Http/Middleware/RoleMiddleware.php b/app/Http/Middleware/RoleMiddleware.php index 055e42d..00a4841 100644 --- a/app/Http/Middleware/RoleMiddleware.php +++ b/app/Http/Middleware/RoleMiddleware.php @@ -21,7 +21,7 @@ public function handle(Request $request, Closure $next, ...$roles): Response } if (!in_array(Auth::user()->role_id, $roles)) { - return abort(403, 'Anda tidak memiliki akses ke halaman ini.'); + abort(403); } return $next($request); diff --git a/public/assets/errors/css/style1.css b/public/assets/errors/css/style1.css new file mode 100644 index 0000000..f279270 --- /dev/null +++ b/public/assets/errors/css/style1.css @@ -0,0 +1,107 @@ +* { + -webkit-box-sizing: border-box; + box-sizing: border-box; +} + +body { + padding: 0; + margin: 0; +} + +#notfound { + position: relative; + height: 100vh; +} + +#notfound .notfound { + position: absolute; + left: 50%; + top: 50%; + -webkit-transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); +} + +.notfound { + max-width: 520px; + width: 100%; + line-height: 1.4; +} + +.notfound>div:first-child { + padding-left: 200px; + padding-top: 12px; + height: 170px; + margin-bottom: 20px; +} + +.notfound .notfound-404 { + position: absolute; + left: 0; + top: 0; + width: 170px; + height: 170px; + background: #e01818; + border-radius: 7px; + -webkit-box-shadow: 0px 0px 0px 10px #e01818 inset, 0px 0px 0px 20px #fff inset; + box-shadow: 0px 0px 0px 10px #e01818 inset, 0px 0px 0px 20px #fff inset; +} + +.notfound .notfound-404 h1 { + font-family: 'Chango', cursive; + color: #fff; + font-size: 118px; + margin: 0px; + position: absolute; + left: 50%; + top: 50%; + -webkit-transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + display: inline-block; + height: 60px; + line-height: 60px; +} + +.notfound h2 { + font-family: 'Chango', cursive; + font-size: 68px; + color: #222; + font-weight: 400; + text-transform: uppercase; + margin: 0px; + line-height: 1.1; +} + +.notfound p { + font-family: 'Montserrat', sans-serif; + font-size: 16px; + font-weight: 400; + color: #222; + margin-top: 5px; +} + +.notfound a { + font-family: 'Montserrat', sans-serif; + color: #e01818; + font-weight: 400; + text-decoration: none; +} + +@media only screen and (max-width: 480px) { + .notfound { + padding-left: 15px; + padding-right: 15px; + } + .notfound>div:first-child { + padding: 0px; + height: auto; + } + .notfound .notfound-404 { + position: relative; + margin-bottom: 15px; + } + .notfound h2 { + font-size: 42px; + } +} diff --git a/public/assets/errors/css/style2.css b/public/assets/errors/css/style2.css new file mode 100644 index 0000000..1a906ea --- /dev/null +++ b/public/assets/errors/css/style2.css @@ -0,0 +1,76 @@ +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + background-color: #f9fbfd; + color: #333; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100vh; + text-align: center; + padding: 20px; +} + +.error-container { + max-width: 600px; + padding: 20px; +} + +.error-container img { + max-width: 300px; + margin-bottom: 30px; +} + +h1 { + font-size: 36px; + margin-bottom: 7px; + color: #2c3e50; +} + +p { + font-size: 16px; + line-height: 1.6; + margin-bottom: 30px; + color: #555; +} + +.back{ + display: inline-block; + text-decoration: none; + background-color: #3498db; + color: #fff; + padding: 12px 24px; + border-radius: 30px; + transition: background 0.3s ease; + font-weight: 500; + /* margin-bottom: 2rem; */ +} + +.back:hover { + background-color: #2980b9; +} + +footer{ + margin-top: 2rem; +} + +.social-links{ + /* margin-top: 2rem; */ + display: flex; + flex-wrap: wrap; + /* background-color: red; */ +} + +.social-links a{ + margin: 0 0.5rem; +} + +.social-links a img{ + width: 1.5rem; +} diff --git a/public/assets/errors/images/400-error.svg b/public/assets/errors/images/400-error.svg new file mode 100644 index 0000000..570a381 --- /dev/null +++ b/public/assets/errors/images/400-error.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/assets/errors/images/401-error.svg b/public/assets/errors/images/401-error.svg new file mode 100644 index 0000000..997960e --- /dev/null +++ b/public/assets/errors/images/401-error.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/assets/errors/images/403-error.svg b/public/assets/errors/images/403-error.svg new file mode 100644 index 0000000..98f4953 --- /dev/null +++ b/public/assets/errors/images/403-error.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/assets/errors/images/404-error.svg b/public/assets/errors/images/404-error.svg new file mode 100644 index 0000000..e63b4b8 --- /dev/null +++ b/public/assets/errors/images/404-error.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/assets/errors/images/405-error.svg b/public/assets/errors/images/405-error.svg new file mode 100644 index 0000000..1beb32c --- /dev/null +++ b/public/assets/errors/images/405-error.svg @@ -0,0 +1 @@ + diff --git a/public/assets/errors/images/408-error.svg b/public/assets/errors/images/408-error.svg new file mode 100644 index 0000000..fed2302 --- /dev/null +++ b/public/assets/errors/images/408-error.svg @@ -0,0 +1 @@ + diff --git a/public/assets/errors/images/419-error.svg b/public/assets/errors/images/419-error.svg new file mode 100644 index 0000000..37eee54 --- /dev/null +++ b/public/assets/errors/images/419-error.svg @@ -0,0 +1 @@ + diff --git a/public/assets/errors/images/500-error.svg b/public/assets/errors/images/500-error.svg new file mode 100644 index 0000000..25fea37 --- /dev/null +++ b/public/assets/errors/images/500-error.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/assets/errors/images/503-error.svg b/public/assets/errors/images/503-error.svg new file mode 100644 index 0000000..c7fa6cd --- /dev/null +++ b/public/assets/errors/images/503-error.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/views/errors/400.blade.php b/resources/views/errors/400.blade.php new file mode 100644 index 0000000..9d37209 --- /dev/null +++ b/resources/views/errors/400.blade.php @@ -0,0 +1,26 @@ + + + + + + 400 Bad Request - {{$app->app_title}} + + @include('partials.app.head') + + + + + + +
+ Error Illustration +

Oops! Bad Request

+

Permintaanmu nggak bisa diproses karena formatnya kurang pas. Yuk dicek lagi dan coba ulangi!

+ Kembali +
+ + {{-- --}} + + diff --git a/resources/views/errors/401.blade.php b/resources/views/errors/401.blade.php new file mode 100644 index 0000000..9653d42 --- /dev/null +++ b/resources/views/errors/401.blade.php @@ -0,0 +1,26 @@ + + + + + + 401 Unauthorized - {{$app->app_title}} + + @include('partials.app.head') + + + + + + +
+ Error Illustration +

Eh, Belum Login!

+

Akses ke halaman ini butuh login dulu. Silakan masuk untuk lanjut.

+ Login +
+ + {{-- --}} + + diff --git a/resources/views/errors/403.blade.php b/resources/views/errors/403.blade.php new file mode 100644 index 0000000..7553740 --- /dev/null +++ b/resources/views/errors/403.blade.php @@ -0,0 +1,26 @@ + + + + + + 403 Forbidden - {{$app->app_title}} + + @include('partials.app.head') + + + + + + +
+ Error Illustration +

Akses Ditolak!

+

Kamu tidak punya izin untuk membuka halaman ini. Kalau merasa ini salah, hubungi admin ya.

+ Kembali +
+ + {{-- --}} + + diff --git a/resources/views/errors/404.blade.php b/resources/views/errors/404.blade.php new file mode 100644 index 0000000..1a84444 --- /dev/null +++ b/resources/views/errors/404.blade.php @@ -0,0 +1,26 @@ + + + + + + 404 Not Found - {{$app->app_title}} + + @include('partials.app.head') + + + + + + +
+ Error Illustration +

Oops! Halaman Tidak Ditemukan

+

Halaman tidak ditemukan. Mungkin sudah dipindahkan atau tautannya salah.

+ Kembali +
+ + {{-- --}} + + diff --git a/resources/views/errors/405.blade.php b/resources/views/errors/405.blade.php new file mode 100644 index 0000000..80c15d6 --- /dev/null +++ b/resources/views/errors/405.blade.php @@ -0,0 +1,26 @@ + + + + + + 405 Method Not Allowed - {{$app->app_title}} + + @include('partials.app.head') + + + + + + +
+ Error Illustration +

Cara Ini Nggak Bisa

+

Metode permintaan ini tidak didukung untuk halaman ini. Silakan coba cara lain.

+ Kembali +
+ + {{-- --}} + + diff --git a/resources/views/errors/408.blade.php b/resources/views/errors/408.blade.php new file mode 100644 index 0000000..ba156b1 --- /dev/null +++ b/resources/views/errors/408.blade.php @@ -0,0 +1,26 @@ + + + + + + 408 Request Time Out - {{$app->app_title}} + + @include('partials.app.head') + + + + + + +
+ Error Illustration +

Waktu Habis Nih

+

Server nunggu terlalu lama dan akhirnya berhenti. Coba ulangi permintaanmu, ya!

+ Kembali +
+ + {{-- --}} + + diff --git a/resources/views/errors/419.blade.php b/resources/views/errors/419.blade.php new file mode 100644 index 0000000..8fe35f1 --- /dev/null +++ b/resources/views/errors/419.blade.php @@ -0,0 +1,26 @@ + + + + + + 419 Page Expired - {{$app->app_title}} + + @include('partials.app.head') + + + + + + +
+ Error Illustration +

Oops! Sesi Kedaluwarsa

+

Sesi kamu sudah habis, biasanya karena terlalu lama diam atau ada masalah token. Silakan muat ulang halaman dan coba lagi, ya!

+ Kembali +
+ + {{-- --}} + + diff --git a/resources/views/errors/500.blade.php b/resources/views/errors/500.blade.php new file mode 100644 index 0000000..9a7e1ef --- /dev/null +++ b/resources/views/errors/500.blade.php @@ -0,0 +1,26 @@ + + + + + + 500 Internal Server Error - {{$app->app_title}} + + @include('partials.app.head') + + + + + + +
+ Error Illustration +

Oops! Ada Kesalahan di Server

+

Terjadi gangguan tak terduga. Tim kami sedang memperbaikinya, coba lagi sebentar ya!

+ Kembali +
+ + {{-- --}} + + diff --git a/resources/views/errors/503.blade.php b/resources/views/errors/503.blade.php new file mode 100644 index 0000000..d7ac4e7 --- /dev/null +++ b/resources/views/errors/503.blade.php @@ -0,0 +1,25 @@ + + + + + + 503 Service Unavailable - {{$app->app_title}} + + @include('partials.app.head') + + + + + + +
+ Error Illustration +

Layanan Sedang Sibuk

+

Server sedang penuh atau dalam perbaikan. Mohon bersabar dan coba beberapa saat lagi.

+
+ + {{-- --}} + + diff --git a/resources/views/errors/partials/media-socials.blade.php b/resources/views/errors/partials/media-socials.blade.php new file mode 100644 index 0000000..e5d9a81 --- /dev/null +++ b/resources/views/errors/partials/media-socials.blade.php @@ -0,0 +1,20 @@ + diff --git a/routes/web.php b/routes/web.php index d37d2f0..92763c5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -50,6 +50,8 @@ Route::prefix('contacts')->name('contacts.')->group(function(){ Route::get('/', 'contact')->name('index'); }); + + Route::get('/errors/{code}', 'customError')->name('error.custom'); }); Route::prefix('auth')->group(function(){