'required|numeric|exists:users,id', 'server_id' => 'required|numeric|exists:servers,id', 'permissions' => 'nullable|array', 'permissions.*' => 'string', ]; protected function casts(): array { return [ 'user_id' => 'int', 'server_id' => 'int', 'permissions' => 'array', ]; } /** * Gets the server associated with a subuser. */ public function server(): BelongsTo { return $this->belongsTo(Server::class); } /** * Gets the user associated with a subuser. */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * Gets the permissions associated with a subuser. */ public function permissions(): HasMany { return $this->hasMany(Permission::class); } }