28 lines
615 B
PHP
28 lines
615 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class TransactionResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
|
|
"id"=>$this->id,
|
|
"type"=>$this->type,
|
|
"amount"=>$this->amount,
|
|
"created_at"=>$this->created_at,
|
|
"category"=> $this->course->category->name
|
|
|
|
];
|
|
}
|
|
}
|