Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greatsami/592cb4f8fbeeacc37afe8b271493a81b to your computer and use it in GitHub Desktop.
Save greatsami/592cb4f8fbeeacc37afe8b271493a81b to your computer and use it in GitHub Desktop.
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