Apply fixes from StyleCI (#294)
This commit is contained in:
parent
a10e235beb
commit
7c916ad38f
21 changed files with 21 additions and 40 deletions
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\API;
|
namespace Pterodactyl\Http\Controllers\API;
|
||||||
|
|
||||||
use DB;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Pterodactyl\Models\Location;
|
use Pterodactyl\Models\Location;
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ class NodeController extends BaseController
|
||||||
|
|
||||||
$node->allocations->transform(function ($item) {
|
$node->allocations->transform(function ($item) {
|
||||||
return collect($item)->only([
|
return collect($item)->only([
|
||||||
'id', 'ip', 'ip_alias', 'port', 'server_id'
|
'id', 'ip', 'ip_alias', 'port', 'server_id',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\API\User;
|
namespace Pterodactyl\Http\Controllers\API\User;
|
||||||
|
|
||||||
use Pterodactyl\Models;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Pterodactyl\Http\Controllers\API\BaseController;
|
use Pterodactyl\Http\Controllers\API\BaseController;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ use Pterodactyl\Exceptions\DisplayException;
|
||||||
use Pterodactyl\Repositories\UserRepository;
|
use Pterodactyl\Repositories\UserRepository;
|
||||||
use Pterodactyl\Exceptions\DisplayValidationException;
|
use Pterodactyl\Exceptions\DisplayValidationException;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
|
||||||
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
|
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Admin;
|
namespace Pterodactyl\Http\Controllers\Admin;
|
||||||
|
|
||||||
use DB;
|
|
||||||
use Log;
|
use Log;
|
||||||
use Alert;
|
use Alert;
|
||||||
use Pterodactyl\Models;
|
use Pterodactyl\Models;
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Admin;
|
namespace Pterodactyl\Http\Controllers\Admin;
|
||||||
|
|
||||||
use DB;
|
|
||||||
use Alert;
|
use Alert;
|
||||||
use Pterodactyl\Models;
|
use Pterodactyl\Models;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Admin;
|
namespace Pterodactyl\Http\Controllers\Admin;
|
||||||
|
|
||||||
use DB;
|
|
||||||
use Log;
|
use Log;
|
||||||
use Alert;
|
use Alert;
|
||||||
use Storage;
|
use Storage;
|
||||||
|
@ -50,7 +49,7 @@ class PackController extends Controller
|
||||||
public function listByOption(Request $request, $id)
|
public function listByOption(Request $request, $id)
|
||||||
{
|
{
|
||||||
return view('admin.services.packs.byoption', [
|
return view('admin.services.packs.byoption', [
|
||||||
'option' => Models\ServiceOptions::with('service', 'packs')->findOrFail($id)
|
'option' => Models\ServiceOptions::with('service', 'packs')->findOrFail($id),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Admin;
|
namespace Pterodactyl\Http\Controllers\Admin;
|
||||||
|
|
||||||
use DB;
|
|
||||||
use Log;
|
use Log;
|
||||||
use Alert;
|
use Alert;
|
||||||
use Pterodactyl\Models;
|
use Pterodactyl\Models;
|
||||||
|
@ -62,7 +61,6 @@ class ServersController extends Controller
|
||||||
|
|
||||||
public function getView(Request $request, $id)
|
public function getView(Request $request, $id)
|
||||||
{
|
{
|
||||||
|
|
||||||
$server = Models\Server::withTrashed()->with(
|
$server = Models\Server::withTrashed()->with(
|
||||||
'user', 'option.variables', 'variables',
|
'user', 'option.variables', 'variables',
|
||||||
'node.allocations', 'databases.host'
|
'node.allocations', 'databases.host'
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Admin;
|
namespace Pterodactyl\Http\Controllers\Admin;
|
||||||
|
|
||||||
use DB;
|
|
||||||
use Log;
|
use Log;
|
||||||
use Alert;
|
use Alert;
|
||||||
use Storage;
|
use Storage;
|
||||||
|
|
|
@ -29,7 +29,6 @@ use Log;
|
||||||
use Alert;
|
use Alert;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Pterodactyl\Models\User;
|
use Pterodactyl\Models\User;
|
||||||
use Pterodactyl\Models\Server;
|
|
||||||
use Pterodactyl\Exceptions\DisplayException;
|
use Pterodactyl\Exceptions\DisplayException;
|
||||||
use Pterodactyl\Http\Controllers\Controller;
|
use Pterodactyl\Http\Controllers\Controller;
|
||||||
use Pterodactyl\Repositories\UserRepository;
|
use Pterodactyl\Repositories\UserRepository;
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
namespace Pterodactyl\Http\Controllers\Base;
|
namespace Pterodactyl\Http\Controllers\Base;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Pterodactyl\Models\Server;
|
|
||||||
use Pterodactyl\Http\Controllers\Controller;
|
use Pterodactyl\Http\Controllers\Controller;
|
||||||
|
|
||||||
class IndexController extends Controller
|
class IndexController extends Controller
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Server;
|
namespace Pterodactyl\Http\Controllers\Server;
|
||||||
|
|
||||||
use DB;
|
|
||||||
use Log;
|
use Log;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Alert;
|
use Alert;
|
||||||
|
|
|
@ -68,10 +68,10 @@ class Allocation extends Model
|
||||||
* Accessor to quickly determine if this allocation has an alias.
|
* Accessor to quickly determine if this allocation has an alias.
|
||||||
*
|
*
|
||||||
* @param null|string $value
|
* @param null|string $value
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function getHasAliasAttribute($value)
|
public function getHasAliasAttribute($value)
|
||||||
{
|
{
|
||||||
return (! is_null($this->ip_alias));
|
return ! is_null($this->ip_alias);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,10 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Permission extends Model
|
class Permission extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should timestamps be used on this model.
|
* Should timestamps be used on this model.
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,8 @@ class ServiceVariables extends Model
|
||||||
'required' => 'integer',
|
'required' => 'integer',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function serverVariables()
|
public function serverVariables()
|
||||||
{
|
{
|
||||||
return $this->hasMany(ServerVariables::class, 'variable_id');
|
return $this->hasMany(ServerVariables::class, 'variable_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Models;
|
namespace Pterodactyl\Models;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Subuser extends Model
|
class Subuser extends Model
|
||||||
|
@ -50,11 +49,11 @@ class Subuser extends Model
|
||||||
*/
|
*/
|
||||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cast values to correct type.
|
* Cast values to correct type.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'user_id' => 'integer',
|
'user_id' => 'integer',
|
||||||
'server_id' => 'integer',
|
'server_id' => 'integer',
|
||||||
|
|
|
@ -177,8 +177,6 @@ class Pack
|
||||||
'selectable' => isset($data['selectable']),
|
'selectable' => isset($data['selectable']),
|
||||||
'visible' => isset($data['visible']),
|
'visible' => isset($data['visible']),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($id)
|
public function delete($id)
|
||||||
|
|
|
@ -80,7 +80,7 @@ class Variable
|
||||||
|
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
try {
|
try {
|
||||||
foreach($variable->serverVariables as $svar) {
|
foreach ($variable->serverVariables as $svar) {
|
||||||
$svar->delete();
|
$svar->delete();
|
||||||
}
|
}
|
||||||
$variable->delete();
|
$variable->delete();
|
||||||
|
|
|
@ -25,8 +25,6 @@
|
||||||
namespace Pterodactyl\Repositories;
|
namespace Pterodactyl\Repositories;
|
||||||
|
|
||||||
use DB;
|
use DB;
|
||||||
use Mail;
|
|
||||||
use Settings;
|
|
||||||
use Validator;
|
use Validator;
|
||||||
use Pterodactyl\Models;
|
use Pterodactyl\Models;
|
||||||
use Pterodactyl\Services\UuidService;
|
use Pterodactyl\Services\UuidService;
|
||||||
|
@ -229,7 +227,7 @@ class SubuserRepository
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach($subuser->permissions as &$permission) {
|
foreach ($subuser->permissions as &$permission) {
|
||||||
$permission->delete();
|
$permission->delete();
|
||||||
}
|
}
|
||||||
$subuser->delete();
|
$subuser->delete();
|
||||||
|
@ -273,7 +271,7 @@ class SubuserRepository
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
foreach($subuser->permissions as &$permission) {
|
foreach ($subuser->permissions as &$permission) {
|
||||||
$permission->delete();
|
$permission->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Services;
|
namespace Pterodactyl\Services;
|
||||||
|
|
||||||
use Pterodactyl\Models\User;
|
|
||||||
use Pterodactyl\Models\Server;
|
use Pterodactyl\Models\Server;
|
||||||
use Pterodactyl\Notifications\Daemon;
|
use Pterodactyl\Notifications\Daemon;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Pterodactyl\Models\Subuser;
|
||||||
|
use Pterodactyl\Models\Permission;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Pterodactyl\Models\Subuser;
|
|
||||||
use Pterodactyl\Models\Permission;
|
|
||||||
|
|
||||||
class SetupPermissionsPivotTable extends Migration
|
class SetupPermissionsPivotTable extends Migration
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ class SetupPermissionsPivotTable extends Migration
|
||||||
});
|
});
|
||||||
|
|
||||||
DB::transaction(function () {
|
DB::transaction(function () {
|
||||||
foreach(Subuser::all() as &$subuser) {
|
foreach (Subuser::all() as &$subuser) {
|
||||||
Permission::where('user_id', $subuser->user_id)->where('server_id', $subuser->server_id)->update([
|
Permission::where('user_id', $subuser->user_id)->where('server_id', $subuser->server_id)->update([
|
||||||
'subuser_id' => $subuser->id,
|
'subuser_id' => $subuser->id,
|
||||||
]);
|
]);
|
||||||
|
@ -55,7 +55,7 @@ class SetupPermissionsPivotTable extends Migration
|
||||||
});
|
});
|
||||||
|
|
||||||
DB::transaction(function () {
|
DB::transaction(function () {
|
||||||
foreach(Subuser::all() as &$subuser) {
|
foreach (Subuser::all() as &$subuser) {
|
||||||
Permission::where('subuser_id', $subuser->id)->update([
|
Permission::where('subuser_id', $subuser->id)->update([
|
||||||
'user_id' => $subuser->user_id,
|
'user_id' => $subuser->user_id,
|
||||||
'server_id' => $subuser->server_id,
|
'server_id' => $subuser->server_id,
|
||||||
|
|
Loading…
Reference in a new issue