mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-03-01 15:05:39 +08:00
Refactor
This commit is contained in:
parent
3a8504c1bf
commit
7e4d439da9
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user