'integer', 'max_databases' => 'integer', 'node_id' => 'integer', ]; /** * Validation rules to assign to this model. * * @var array */ public static $validationRules = [ 'name' => 'required|string|max:255', 'host' => 'required|string', 'port' => 'required|numeric|between:1,65535', 'username' => 'required|string|max:32', 'password' => 'nullable|string', 'node_id' => 'sometimes|nullable|integer|exists:nodes,id', ]; /** * Gets the node associated with a database host. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function node() { return $this->belongsTo(Node::class); } /** * Gets the databases associated with this host. * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function databases() { return $this->hasMany(Database::class); } }