Skip to content

Commit 8942b33

Browse files
committed
Reworked maintenance mode
#590
1 parent a59e98e commit 8942b33

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

app/Http/Middleware/CheckBlockedUser.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ public function handle($request, Closure $next)
2020
if (Auth::check() && Auth::user()->block === "yes") {
2121
return redirect()->route('blocked');
2222
}
23+
if (env('MAINTENANCE_MODE') == 'true' && (Auth::check() && Auth::user()->role != 'admin')) {
24+
return redirect(url(''));
25+
}
2326

2427
return $next($request);
2528
}
26-
}
29+
}

routes/web.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
//Public route
8787
$custom_prefix = config('advanced-config.custom_url_prefix');
8888
Route::get('/going/{id?}', [UserController::class, 'clickNumber'])->where('link', '.*')->name('clickNumber');
89-
if($custom_prefix != ""){Route::get('/' . $custom_prefix . '{littlelink}', [UserController::class, 'littlelink'])->name('littlelink');}}
89+
if($custom_prefix != ""){Route::get('/' . $custom_prefix . '{littlelink}', [UserController::class, 'littlelink'])->name('littlelink');}
9090
Route::get('/@{littlelink}', [UserController::class, 'littlelink'])->name('littlelink');
9191
Route::get('/pages/'.strtolower(footer('Terms')), [AdminController::class, 'pagesTerms'])->name('pagesTerms');
9292
Route::get('/pages/'.strtolower(footer('Privacy')), [AdminController::class, 'pagesPrivacy'])->name('pagesPrivacy');
@@ -97,6 +97,8 @@
9797

9898
Route::get('/demo-page', [App\Http\Controllers\HomeController::class, 'demo'])->name('demo');
9999

100+
}
101+
100102
Route::middleware(['auth', 'blocked', 'impersonate'])->group(function () {
101103
//User route
102104
Route::group([

0 commit comments

Comments
 (0)