Upgrade to Laravel 9 (#4413)

Co-authored-by: DaneEveritt <dane@daneeveritt.com>
This commit is contained in:
Matthew Penner 2022-10-14 10:59:20 -06:00 committed by GitHub
parent 95e15d2c8a
commit cbcf62086f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
573 changed files with 4387 additions and 9411 deletions

View file

@ -2,6 +2,9 @@
namespace Pterodactyl\Models;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @property int $id
* @property int $server_id
@ -29,22 +32,16 @@ class ServerTransfer extends Model
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'server_transfers';
/**
* Fields that are not mass assignable.
*
* @var array
*/
protected $guarded = ['id', 'created_at', 'updated_at'];
/**
* Cast values to correct type.
*
* @var array
*/
protected $casts = [
'server_id' => 'int',
@ -58,10 +55,7 @@ class ServerTransfer extends Model
'archived' => 'bool',
];
/**
* @var array
*/
public static $validationRules = [
public static array $validationRules = [
'server_id' => 'required|numeric|exists:servers,id',
'old_node' => 'required|numeric',
'new_node' => 'required|numeric',
@ -76,30 +70,24 @@ class ServerTransfer extends Model
/**
* Gets the server associated with a server transfer.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function server()
public function server(): BelongsTo
{
return $this->belongsTo(Server::class);
}
/**
* Gets the source node associated with a server transfer.
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function oldNode()
public function oldNode(): HasOne
{
return $this->hasOne(Node::class, 'id', 'old_node');
}
/**
* Gets the target node associated with a server transfer.
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function newNode()
public function newNode(): HasOne
{
return $this->hasOne(Node::class, 'id', 'new_node');
}