*/ public static array $validationRules = [ 'name' => 'required|string|max:255', 'host' => 'required|string', 'port' => 'required|numeric|between:1,65535', 'username' => 'required|string|max:32', 'password' => 'nullable|string', 'node_ids' => 'nullable|array', 'node_ids.*' => 'required|integer,exists:nodes,id', ]; protected function casts(): array { return [ 'id' => 'integer', 'max_databases' => 'integer', 'password' => 'encrypted', 'created_at' => 'immutable_datetime', 'updated_at' => 'immutable_datetime', ]; } public function nodes(): BelongsToMany { return $this->belongsToMany(Node::class); } /** * Gets the databases associated with this host. */ public function databases(): HasMany { return $this->hasMany(Database::class); } }