mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-10 20:51:07 +03:30
42 lines
1.5 KiB
PHP
42 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Services\Media\Resources\MediaResource;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class TestResultResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray( $request )
|
|
{
|
|
return [
|
|
'id' => $this->id ,
|
|
'info' => $this->info ,
|
|
'cycle_number' => $this->cycle_number ,
|
|
'date' => $this->date ,
|
|
'result' => $this->result ,
|
|
'description' => $this->description ,
|
|
'verified' => $this->verified ,
|
|
'device_id' => $this->device_id ,
|
|
'user_id' => $this->user_id ,
|
|
'test_type_id' => $this->test_type_id ,
|
|
'test_type' => $this->when( $this->test_type , $this->test_type ) ,
|
|
'inputs' => $this->when( $this->inputs , $this->inputs ) ,
|
|
'options' => $this->when( $this->options , $this->options ) ,
|
|
'device_label' => $this->when( $this->device_label , $this->device_label ) ,
|
|
'input_values' => $this->when( $this->input_values , $this->input_values ) ,
|
|
'user' => UserResource::make( $this->whenLoaded( 'user' ) ) ,
|
|
'files' => MediaResource::collection($this->whenLoaded('media')) ,
|
|
'created_at' => $this->created_at ,
|
|
'updated_at' => $this->updated_at
|
|
];
|
|
}
|
|
}
|