-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
penambahan pengaturan dan halaman maintenace (#902)
- Loading branch information
1 parent
22f0997
commit 89b8ac2
Showing
8 changed files
with
209 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Http\Middleware; | ||
|
||
use App\Models\SettingAplikasi; | ||
use Closure; | ||
|
||
class MaintenanceMode | ||
{ | ||
/** | ||
* Handle an incoming request. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Closure $next | ||
* @return mixed | ||
*/ | ||
public function handle($request, Closure $next) | ||
{ | ||
$maintenance = SettingAplikasi::find(11); | ||
if ($maintenance) { | ||
if ($maintenance->value == 1) { | ||
abort(503); | ||
} | ||
} | ||
|
||
return $next($request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
database/migrations/2023_10_19_154602_maintenance_mode.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
use App\Enums\Status; | ||
use App\Models\SettingAplikasi; | ||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class MaintenanceMode extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
SettingAplikasi::insert([ | ||
'id' => 11, | ||
'key' => 'mode_maintenance', | ||
'value' => Status::TidakAktif, | ||
'type' => 'boolean', | ||
'description' => 'Mode maintenance.', | ||
'kategori' => 'web', | ||
'option' => '{}', | ||
]); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
SettingAplikasi::where('key', 'mode_maintenance')->delete(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,18 @@ | ||
@extends('errors::minimal') | ||
<!doctype html> | ||
<title>Sedang dalam Perbaikan</title> | ||
<style> | ||
body { text-align: center; padding: 150px; } | ||
h1 { font-size: 50px; } | ||
body { font: 20px Helvetica, sans-serif; color: #333; } | ||
article { display: block; text-align: left; width: 650px; margin: 0 auto; } | ||
a { color: #dc8100; text-decoration: none; } | ||
a:hover { color: #333; text-decoration: none; } | ||
</style> | ||
|
||
@section('title', __('Service Unavailable')) | ||
@section('code', '503') | ||
@section('message', __($exception->getMessage() ?: 'Service Unavailable')) | ||
<article> | ||
<h1>Sedang dalam Perbaikan!</h1> | ||
<div> | ||
<p>Mohon maaf atas ketidaknyamanannya. Situs ini sedang dalam perbaikan.</p> | ||
<p>— {{ env('APP_NAME') }}</p> | ||
</div> | ||
</article> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.