mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-12 19:01:05 +03:30
fix some problems
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?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->media ) ,
|
||||
'thumbnail' => $this->getFirstMediaUrl( 'main_images' , 'thumbnail' ) ,
|
||||
'created_at' => $this->created_at ,
|
||||
'updated_at' => $this->updated_at
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user