Skip to content

Commit

Permalink
feature: add update function
Browse files Browse the repository at this point in the history
  • Loading branch information
glaubersilva committed Dec 13, 2023
1 parent c471a2a commit 88785ea
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/Revenue/Repositories/Revenue.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Give\Donations\Models\Donation;
use Give\Framework\Database\DB;
use Give\Framework\Exceptions\Primitives\InvalidArgumentException;
use Give\Framework\Support\ValueObjects\Money;

/**
* Class Revenue
Expand Down Expand Up @@ -48,6 +47,29 @@ public function insert($revenueData)
);
}

/**
* Update revenue.
*
* @unreleased
*
* @return bool|int
*/
public function update(array $revenueData)
{
global $wpdb;

// Validate revenue data
$this->validateNewRevenueData($revenueData);

return DB::update(
$wpdb->give_revenue,
$revenueData,
['donation_id' => $revenueData['donation_id']],
['%d'],
['%d']
);
}

/**
* Deletes revenue
*
Expand Down

0 comments on commit 88785ea

Please sign in to comment.