Created
July 17, 2019 13:19
-
-
Save greatsami/592cb4f8fbeeacc37afe8b271493a81b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class CheckSiteStatus | |
{ | |
/** | |
* Handle an incoming request. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param \Closure $next | |
* @return mixed | |
*/ | |
public function handle($request, Closure $next) | |
{ | |
// 0 = Active | 1 = Inactive | |
$site_setting = getSettingsOf('site_status'); | |
$visitor = Auth::check() && Auth::user()->roles->first()->name == 'admin' ? 'true' : 'false'; | |
if ($site_setting == '1' && $visitor == 'false') { | |
return response()->view('errors.be_right_back', ['message' => 'Ooops, we are working on amazing features...']); | |
} | |
return $next($request); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment