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\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @property int $id
* @property string $name
@ -22,29 +25,20 @@ class DatabaseHost extends Model
*/
public const RESOURCE_NAME = 'database_host';
/**
* @var bool
*/
protected $immutableDates = true;
protected bool $immutableDates = true;
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'database_hosts';
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['password'];
/**
* Fields that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'host', 'port', 'username', 'password', 'max_databases', 'node_id',
@ -52,8 +46,6 @@ class DatabaseHost extends Model
/**
* Cast values to correct type.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
@ -63,10 +55,8 @@ class DatabaseHost extends Model
/**
* Validation rules to assign to this model.
*
* @var array
*/
public static $validationRules = [
public static array $validationRules = [
'name' => 'required|string|max:191',
'host' => 'required|string',
'port' => 'required|numeric|between:1,65535',
@ -77,20 +67,16 @@ class DatabaseHost extends Model
/**
* Gets the node associated with a database host.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function node()
public function node(): BelongsTo
{
return $this->belongsTo(Node::class);
}
/**
* Gets the databases associated with this host.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function databases()
public function databases(): HasMany
{
return $this->hasMany(Database::class);
}