Turns out I hate that huge space formatting, disable that mess

This commit is contained in:
Dane Everitt 2021-01-27 20:52:11 -08:00
parent 0ae90eacaa
commit 5515871b2f
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
34 changed files with 318 additions and 322 deletions

View File

@ -23,6 +23,17 @@ return (new Config())
'ordered_imports' => [ 'ordered_imports' => [
'sortAlgorithm' => 'length', 'sortAlgorithm' => 'length',
], ],
'phpdoc_align' => [
'align' => 'left',
'tags' => [
'param',
'property',
'return',
'throws',
'type',
'var',
],
],
'random_api_migration' => true, 'random_api_migration' => true,
'ternary_to_null_coalescing' => true, 'ternary_to_null_coalescing' => true,
'yoda_style' => [ 'yoda_style' => [

View File

@ -2,8 +2,16 @@
namespace Pterodactyl\Models; namespace Pterodactyl\Models;
use Illuminate\Database\Eloquent\Model; /**
* @property int $id
* @property int $server_id
* @property int $variable_id
* @property string $variable_value
* @property \Carbon\CarbonImmutable|null $created_at
* @property \Carbon\CarbonImmutable|null $updated_at
* @property \Pterodactyl\Models\EggVariable $variable
* @property \Pterodactyl\Models\Server $server
*/
class ServerVariable extends Model class ServerVariable extends Model
{ {
/** /**
@ -12,58 +20,36 @@ class ServerVariable extends Model
*/ */
public const RESOURCE_NAME = 'server_variable'; public const RESOURCE_NAME = 'server_variable';
/** /** @var bool */
* The table associated with the model. protected $immutableDates = true;
*
* @var string /** @var string */
*/
protected $table = 'server_variables'; protected $table = 'server_variables';
/** /** @var string[] */
* Fields that are not mass assignable.
*
* @var array
*/
protected $guarded = ['id', 'created_at', 'updated_at']; protected $guarded = ['id', 'created_at', 'updated_at'];
/** /** @var string[] */
* Cast values to correct type.
*
* @var array
*/
protected $casts = [ protected $casts = [
'server_id' => 'integer', 'server_id' => 'integer',
'variable_id' => 'integer', 'variable_id' => 'integer',
]; ];
/** /** @var string[] */
* Determine if variable is viewable by users. public static $validationRules = [
* 'server_id' => 'required|int',
* @return bool 'variable_id' => 'required|int',
*/ 'variable_value' => 'string',
public function getUserCanViewAttribute() ];
{
return (bool) $this->variable->user_viewable;
}
/** /**
* Determine if variable is editable by users. * Returns the server this variable is associated with.
* *
* @return bool * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/ */
public function getUserCanEditAttribute() public function server()
{ {
return (bool) $this->variable->user_editable; return $this->belongsTo(Server::class);
}
/**
* Determine if variable is required.
*
* @return bool
*/
public function getRequiredAttribute()
{
return $this->variable->required;
} }
/** /**

View File

@ -3,8 +3,8 @@
namespace Pterodactyl\Services\Eggs\Sharing; namespace Pterodactyl\Services\Eggs\Sharing;
use Ramsey\Uuid\Uuid; use Ramsey\Uuid\Uuid;
use Pterodactyl\Models\Egg;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Pterodactyl\Models\Egg;
use Illuminate\Http\UploadedFile; use Illuminate\Http\UploadedFile;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Database\ConnectionInterface; use Illuminate\Database\ConnectionInterface;

View File

@ -5,7 +5,6 @@ namespace Pterodactyl\Transformers\Api\Application;
use Pterodactyl\Models\Egg; use Pterodactyl\Models\Egg;
use Pterodactyl\Models\Nest; use Pterodactyl\Models\Nest;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Support\Collection;
use Pterodactyl\Models\EggVariable; use Pterodactyl\Models\EggVariable;
use Pterodactyl\Services\Acl\Api\AdminAcl; use Pterodactyl\Services\Acl\Api\AdminAcl;

View File

@ -68,7 +68,7 @@
} }
}, },
"scripts": { "scripts": {
"php-cs-fixer": "php-cs-fixer fix --diff --diff-format=udiff --config=./.php_cs.dist --rules=psr_autoloading", "php-cs-fixer": "php-cs-fixer fix --diff --diff-format=udiff --config=./.php_cs.dist",
"post-root-package-install": [ "post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
], ],

View File

@ -1,8 +1,8 @@
<?php <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class UpdateFileDenylistToJson extends Migration class UpdateFileDenylistToJson extends Migration
{ {