|
@@ -19,18 +19,19 @@ public function toArray(Request $request): array
|
|
|
{
|
|
{
|
|
|
return [
|
|
return [
|
|
|
'id' => $this->id,
|
|
'id' => $this->id,
|
|
|
- 'name' => $this->name,
|
|
|
|
|
|
|
+ 'unit_id' => $this->unit_id,
|
|
|
|
|
+ 'transaction_type' => $this->transaction_type,
|
|
|
|
|
+ 'from_account_id' => $this->from_account_id,
|
|
|
|
|
+ 'to_account_id' => $this->to_account_id,
|
|
|
|
|
+ // Banco da movimentação (destino na entrada, origem na saída).
|
|
|
|
|
+ 'account_id' => $this->transaction_type === 'entrada' ? $this->to_account_id : $this->from_account_id,
|
|
|
|
|
+ 'description' => $this->description,
|
|
|
|
|
+ 'amount' => (float) $this->amount,
|
|
|
|
|
+ 'launch_date' => $this->launch_date,
|
|
|
|
|
+ 'origin' => $this->origin,
|
|
|
|
|
+ 'is_reconciled' => (bool) $this->is_reconciled,
|
|
|
'created_at' => Carbon::parse($this->created_at)->format('Y-m-d H:i:s'),
|
|
'created_at' => Carbon::parse($this->created_at)->format('Y-m-d H:i:s'),
|
|
|
'updated_at' => Carbon::parse($this->updated_at)->format('Y-m-d H:i:s'),
|
|
'updated_at' => Carbon::parse($this->updated_at)->format('Y-m-d H:i:s'),
|
|
|
- // Add your fields here
|
|
|
|
|
-
|
|
|
|
|
- // Conditional fields
|
|
|
|
|
- // $this->mergeWhen($request->user()?->isAdmin(), [
|
|
|
|
|
- // 'internal_notes' => $this->internal_notes,
|
|
|
|
|
- // ]),
|
|
|
|
|
-
|
|
|
|
|
- // Relationships
|
|
|
|
|
- // 'user' => new UserResource($this->whenLoaded('user')),
|
|
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
|
|
|