Use new attribute casting
This commit is contained in:
parent
e49ba65709
commit
8a526539be
7 changed files with 88 additions and 80 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Pterodactyl\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
|
@ -75,9 +76,11 @@ class EggVariable extends Model
|
|||
'user_viewable' => 0,
|
||||
];
|
||||
|
||||
public function getRequiredAttribute(): bool
|
||||
public function required(): Attribute
|
||||
{
|
||||
return in_array('required', explode('|', $this->rules));
|
||||
return Attribute::make(
|
||||
get: fn ($value, $attributes) => in_array('required', explode('|', $this->rules)),
|
||||
);
|
||||
}
|
||||
|
||||
public function egg(): HasOne
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue