Use in Middleware
LadyNay opened this issue · 2 comments
Hi,
I am battling to get the value of the settings or checking it. I want to check if the setting is 'yes' then the maintenance page will show if not then not.
I am using it in the middleware and have called it in the boot like you showed me the last time:
Tried this as well: I get the page now, though the status is not being picked up and the page shows regardless:
public function handle($request, Closure $next)
{
if(AppSetting::get('app_maintenance') == 'yes') {
return redirect()->route('maintenance');
} else {
return $next($request);
}
}
public function handle($request, Closure $next)
{
if(setting('app_maintenance') == true) {
return Response::view('frontend.single_pages.maintenancemode');
} else {
return $next($request);
}
}
I think my app was just stuck, but the above works if anyone needs the code.