Files
faveo/app/Http/Middleware/CheckBoard.php
Shift 0b263803ad Apply Laravel coding style
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions.

You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root.

For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
2023-01-07 20:55:49 +00:00

48 lines
1001 B
PHP

<?php
namespace App\Http\Middleware;
use App\Model\helpdesk\Settings\System;
use Closure;
/**
* CheckBoard.
* Checking if the system board is online or offline.
*
* @author Ladybird <info@ladybirdweb.com>
*/
class CheckBoard
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return type Mixed
*/
public function handle($request, Closure $next)
{
if ($this->checkBoard() == '1') {
return $next($request);
} else {
return redirect()->route('board.offline')->with('offline', 'the system seems to be offline please try later');
}
}
/**
* Function to get the system offline details.
*
* @return type Mixed
*/
public function checkBoard()
{
$res = 0;
$system = new System();
if ($system->first()) {
$res = $system->first()->status;
}
return $res;
}
}