This commit is contained in:
Pig Fang 2019-03-31 11:00:07 +08:00
parent 3a8504c1bf
commit 7e4d439da9
4 changed files with 6 additions and 24 deletions

View File

@ -180,9 +180,7 @@ class TextureController extends Controller
public function raw($tid)
{
if (! option('allow_downloading_texture')) {
abort(404);
}
abort_unless(option('allow_downloading_texture'), 404);
return ($t = Texture::find($tid))
? $this->texture($t->hash)
@ -192,10 +190,7 @@ class TextureController extends Controller
public function avatarByPlayer($size, $name)
{
$player = Player::where('name', $name)->first();
if (! $player) {
return abort(404);
}
abort_unless($player, 404);
$hash = $player->getTexture('skin');
if (Storage::disk('textures')->has($hash)) {
@ -213,11 +208,7 @@ class TextureController extends Controller
protected function getPlayerInstance($player_name)
{
$player = Player::where('name', $player_name)->first();
if ($player->isBanned()) {
abort(403, trans('general.player-banned'));
}
abort_if($player->isBanned(), 403, trans('general.player-banned'));
return $player;
}

View File

@ -6,10 +6,7 @@ class CheckAdministrator
{
public function handle($request, \Closure $next)
{
if (! auth()->user()->isAdmin()) {
abort(403, trans('auth.check.admin'));
}
abort_unless(auth()->user()->isAdmin(), 403, trans('auth.check.admin'));
return $next($request);
}
}

View File

@ -9,10 +9,7 @@ class CheckSuperAdmin
{
public function handle($request, Closure $next)
{
if (auth()->user()->permission != User::SUPER_ADMIN) {
abort(403, trans('auth.check.super-admin'));
}
abort_if(auth()->user()->permission != User::SUPER_ADMIN, 403, trans('auth.check.super-admin'));
return $next($request);
}
}

View File

@ -6,10 +6,7 @@ class CheckUserVerified
{
public function handle($request, \Closure $next)
{
if (option('require_verification') && ! auth()->user()->verified) {
abort(403, trans('auth.check.verified'));
}
abort_if(option('require_verification') && ! auth()->user()->verified, 403, trans('auth.check.verified'));
return $next($request);
}
}