*/ use HasFactory; public const string RESOURCE_NAME = 'egg_variable'; public const string RESERVED_ENV_NAMES = 'SERVER_MEMORY,SERVER_IP,SERVER_PORT,ENV,HOME,USER,STARTUP,SERVER_UUID,UUID'; protected $attributes = [ 'user_editable' => 0, 'user_viewable' => 0, ]; /** * @return array */ protected function casts(): array { return [ 'egg_id' => 'integer', 'env_variable' => 'string', 'user_viewable' => 'bool', 'user_editable' => 'bool', 'sort_order' => 'integer', ]; } /** * @return BelongsTo */ public function egg(): BelongsTo { return $this->belongsTo(Egg::class); } /** * @return HasMany */ public function serverVariable(): HasMany { return $this->hasMany(ServerVariable::class, 'variable_id'); } /** * @return Attribute */ protected function required(): Attribute { return Attribute::make(get: fn (): bool => in_array('required', explode('|', $this->rules ?? ''))); } }