Update to Laravel 8

Co-authored-by: Matthew Penner <me@matthewp.io>
This commit is contained in:
Dane Everitt 2021-01-23 12:09:16 -08:00
parent 028921b42a
commit a043071e3c
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
211 changed files with 4394 additions and 2933 deletions

View file

@ -18,6 +18,10 @@ use Pterodactyl\Services\Acl\Api\AdminAcl;
*/
class ApiKey extends Model
{
/**
* The resource name for this model when it is transformed into an
* API representation using fractal.
*/
const RESOURCE_NAME = 'api_key';
/**

View file

@ -2,6 +2,18 @@
namespace Pterodactyl\Models;
/**
* @property int $id
* @property string $name
* @property string $host
* @property int $port
* @property string $username
* @property string $password
* @property int|null $max_databases
* @property int|null $node_id
* @property \Carbon\CarbonImmutable $created_at
* @property \Carbon\CarbonImmutable $updated_at
*/
class DatabaseHost extends Model
{
/**
@ -10,6 +22,11 @@ class DatabaseHost extends Model
*/
const RESOURCE_NAME = 'database_host';
/**
* @var bool
*/
protected $immutableDates = true;
/**
* The table associated with the model.
*

View file

@ -42,12 +42,12 @@ class MultiFieldServerFilter implements Filter
$parts = explode(':', $value);
$builder->when(
!Str::startsWith($value, ':'),
! Str::startsWith($value, ':'),
// When the string does not start with a ":" it means we're looking for an IP or IP:Port
// combo, so use a query to handle that.
function (Builder $builder) use ($parts) {
$builder->orWhere('allocations.ip', $parts[0]);
if (!is_null($parts[1] ?? null)) {
if (! is_null($parts[1] ?? null)) {
$builder->where('allocations.port', 'LIKE', "{$parts[1]}%");
}
},

View file

@ -6,11 +6,14 @@ use Illuminate\Support\Str;
use Illuminate\Validation\Rule;
use Illuminate\Container\Container;
use Illuminate\Contracts\Validation\Factory;
use Illuminate\Database\Eloquent\Model as IlluminateModel;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Pterodactyl\Exceptions\Model\DataValidationException;
use Illuminate\Database\Eloquent\Model as IlluminateModel;
abstract class Model extends IlluminateModel
{
use HasFactory;
/**
* Set to true to return immutable Carbon date instances from the model.
*

View file

@ -87,7 +87,7 @@ class Mount extends Model
public $timestamps = false;
/**
* Blacklisted source paths
* Blacklisted source paths.
*
* @var string[]
*/
@ -98,7 +98,7 @@ class Mount extends Model
];
/**
* Blacklisted target paths
* Blacklisted target paths.
*
* @var string[]
*/

View file

@ -202,7 +202,7 @@ class Node extends Model
*/
public function getDecryptedKey(): string
{
return (string)Container::getInstance()->make(Encrypter::class)->decrypt(
return (string) Container::getInstance()->make(Encrypter::class)->decrypt(
$this->daemon_token
);
}