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

@ -3,6 +3,8 @@
namespace Pterodactyl\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @property int $id
@ -26,22 +28,16 @@ class Subuser extends Model
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'subusers';
/**
* Fields that are not mass assignable.
*
* @var array
*/
protected $guarded = ['id', 'created_at', 'updated_at'];
/**
* Cast values to correct type.
*
* @var array
*/
protected $casts = [
'user_id' => 'int',
@ -49,10 +45,7 @@ class Subuser extends Model
'permissions' => 'array',
];
/**
* @var array
*/
public static $validationRules = [
public static array $validationRules = [
'user_id' => 'required|numeric|exists:users,id',
'server_id' => 'required|numeric|exists:servers,id',
'permissions' => 'nullable|array',
@ -61,40 +54,32 @@ class Subuser extends Model
/**
* Return a hashid encoded string to represent the ID of the subuser.
*
* @return string
*/
public function getHashidAttribute()
public function getHashidAttribute(): string
{
return app()->make('hashids')->encode($this->id);
}
/**
* Gets the server associated with a subuser.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function server()
public function server(): BelongsTo
{
return $this->belongsTo(Server::class);
}
/**
* Gets the user associated with a subuser.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
/**
* Gets the permissions associated with a subuser.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function permissions()
public function permissions(): HasMany
{
return $this->hasMany(Permission::class);
}