mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-02-10 13:39:22 -06:00
40 lines
1004 B
PHP
40 lines
1004 B
PHP
<?php
|
|
/**
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
|
|
* The details is bundled with this project in the file LICENSE.txt.
|
|
*
|
|
* @project UNIT3D
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
|
* @author HDVinnie
|
|
*/
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use \Toastr;
|
|
|
|
class CheckIfBanned
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Closure $next
|
|
* @param string|null $guard
|
|
* @return mixed
|
|
*/
|
|
public function handle($request, Closure $next, $guard = null)
|
|
{
|
|
$user = auth()->user();
|
|
if ($user and $user->group_id == 5) {
|
|
auth()->logout();
|
|
$request->session()->flush();
|
|
return redirect('login')->with(Toastr::error('This account is Banned!', 'Whoops!', ['options']));
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|