27 lines
817 B
PHP
27 lines
817 B
PHP
<?php
|
|
|
|
namespace App\Endpoint\Api\Http\Resources;
|
|
|
|
use App\Models\DistributionPreIncome;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class DistributionPreIncomeResource 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 [
|
|
'remarks' => $this->remarks,
|
|
'logs' => DistributionPreIncomeLogResource::collection($this->whenLoaded('logs')),
|
|
'created_at'=> $this->created_at->format('y-m-d H:i'),
|
|
'total_revenue' => $this->total_revenue,
|
|
'status' => DistributionPreIncome::$statusTexts[$this->status],
|
|
];
|
|
}
|
|
}
|