Refactor
This commit is contained in:
parent
3a8504c1bf
commit
7e4d439da9
|
|
@ -180,9 +180,7 @@ class TextureController extends Controller
|
||||||
|
|
||||||
public function raw($tid)
|
public function raw($tid)
|
||||||
{
|
{
|
||||||
if (! option('allow_downloading_texture')) {
|
abort_unless(option('allow_downloading_texture'), 404);
|
||||||
abort(404);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ($t = Texture::find($tid))
|
return ($t = Texture::find($tid))
|
||||||
? $this->texture($t->hash)
|
? $this->texture($t->hash)
|
||||||
|
|
@ -192,10 +190,7 @@ class TextureController extends Controller
|
||||||
public function avatarByPlayer($size, $name)
|
public function avatarByPlayer($size, $name)
|
||||||
{
|
{
|
||||||
$player = Player::where('name', $name)->first();
|
$player = Player::where('name', $name)->first();
|
||||||
|
abort_unless($player, 404);
|
||||||
if (! $player) {
|
|
||||||
return abort(404);
|
|
||||||
}
|
|
||||||
|
|
||||||
$hash = $player->getTexture('skin');
|
$hash = $player->getTexture('skin');
|
||||||
if (Storage::disk('textures')->has($hash)) {
|
if (Storage::disk('textures')->has($hash)) {
|
||||||
|
|
@ -213,11 +208,7 @@ class TextureController extends Controller
|
||||||
protected function getPlayerInstance($player_name)
|
protected function getPlayerInstance($player_name)
|
||||||
{
|
{
|
||||||
$player = Player::where('name', $player_name)->first();
|
$player = Player::where('name', $player_name)->first();
|
||||||
|
abort_if($player->isBanned(), 403, trans('general.player-banned'));
|
||||||
if ($player->isBanned()) {
|
|
||||||
abort(403, trans('general.player-banned'));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $player;
|
return $player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,7 @@ class CheckAdministrator
|
||||||
{
|
{
|
||||||
public function handle($request, \Closure $next)
|
public function handle($request, \Closure $next)
|
||||||
{
|
{
|
||||||
if (! auth()->user()->isAdmin()) {
|
abort_unless(auth()->user()->isAdmin(), 403, trans('auth.check.admin'));
|
||||||
abort(403, trans('auth.check.admin'));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,7 @@ class CheckSuperAdmin
|
||||||
{
|
{
|
||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
if (auth()->user()->permission != User::SUPER_ADMIN) {
|
abort_if(auth()->user()->permission != User::SUPER_ADMIN, 403, trans('auth.check.super-admin'));
|
||||||
abort(403, trans('auth.check.super-admin'));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,7 @@ class CheckUserVerified
|
||||||
{
|
{
|
||||||
public function handle($request, \Closure $next)
|
public function handle($request, \Closure $next)
|
||||||
{
|
{
|
||||||
if (option('require_verification') && ! auth()->user()->verified) {
|
abort_if(option('require_verification') && ! auth()->user()->verified, 403, trans('auth.check.verified'));
|
||||||
abort(403, trans('auth.check.verified'));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user