Skip to content

Commit

Permalink
fix: allow users delete transactions of the team
Browse files Browse the repository at this point in the history
  • Loading branch information
jesusantguerrero committed Aug 5, 2023
1 parent 44c5c4a commit 6a41476
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Http/Controllers/TransactionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Laravel\Jetstream\Jetstream;


class TransactionController
final class TransactionController
{

public function __construct()
Expand Down Expand Up @@ -77,13 +77,11 @@ public function update(Request $request, Response $response, $id) {
}

public function destroy(Request $request, Response $response, $id) {
$postData = $request->post();
$postData['user_id'] = $request->user()->id;
$postData['team_id'] = $request->user()->current_team_id;
$transaction = Transaction::where([
'user_id'=> $request->user()->id,
'team_id'=> $request->user()->current_team_id,
'id' => $id
])->first();
])
->first();
$transaction->remove();
if ($request->query('json')) {
return $response->sendContent($transaction);
Expand Down

0 comments on commit 6a41476

Please sign in to comment.