feat: updates on expenses
This commit is contained in:
21
app/Commands/Balances/CreateBalanceCommand.php
Normal file
21
app/Commands/Balances/CreateBalanceCommand.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands\Balances;
|
||||
|
||||
use App\Commands\Command;
|
||||
use App\Models\Balance;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CreateBalanceCommand implements Command
|
||||
{
|
||||
public function execute(array $data): mixed
|
||||
{
|
||||
return DB::transaction(
|
||||
callback: fn () => Balance::query()->updateOrCreate([
|
||||
'id' => $data['id'],
|
||||
'account_id' => $data['account_id'],
|
||||
], $data),
|
||||
attempts: 2
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user