integer('qty'); if ($qty >= 1) { return new RemoveQuantityFromBasketInput( $this->getProductId(), $qty ); } return new RemoveProductFromBasketInput( $this->getProductId() ); } public function getProductId(): ProductId { return new ProductId( Uuid::fromString( $this->string('rowId')->value() ) ); } /** @return array */ public function rules(): array { return [ 'rowId' => ['required', 'string', 'uuid'], 'qty' => ['sometimes', 'integer', 'gt:0'], ]; } }