You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
747 B
27 lines
747 B
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class ExerciseResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'name' => $this->lesson_name,
|
|
'description' => $this->description,
|
|
'level' => $this->level_label,
|
|
'year' => $this->year,
|
|
'skills' => SkillResource::collection($this->whenLoaded('skills')),
|
|
'question_groups' => QuestionGroupResource::collection($this->whenLoaded('questionGroups')),
|
|
];
|
|
}
|
|
}
|
|
|