Files
investbrain/app/Http/Resources/TransactionResource.php
T

35 lines
939 B
PHP
Raw Normal View History

2025-01-23 22:47:16 -06:00
<?php
2025-01-24 19:24:16 -06:00
declare(strict_types=1);
2025-01-23 22:47:16 -06:00
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class TransactionResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
2025-01-24 19:24:16 -06:00
return [
'id' => $this->id,
'symbol' => $this->symbol,
'portfolio_id' => $this->portfolio_id,
'transaction_type' => $this->transaction_type,
'quantity' => $this->quantity,
'cost_basis' => $this->cost_basis,
'sale_price' => $this->sale_price,
'split' => $this->split,
'reinvested_dividend' => $this->reinvested_dividend,
'date' => $this->date,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
2025-01-23 22:47:16 -06:00
}
}