Compare commits
No commits in common. 'master' and 'feature/api-create-exercise' have entirely different histories.
master
...
feature/ap
15 changed files with 35 additions and 9709 deletions
@ -1,24 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
namespace App\Http\Resources; |
|
||||||
|
|
||||||
use Illuminate\Http\Request; |
|
||||||
use Illuminate\Http\Resources\Json\JsonResource; |
|
||||||
|
|
||||||
class BlankResource extends JsonResource |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Transform the resource into an array. |
|
||||||
* |
|
||||||
* @return array<string, mixed> |
|
||||||
*/ |
|
||||||
public function toArray(Request $request): array |
|
||||||
{ |
|
||||||
return [ |
|
||||||
'id' => $this->id, |
|
||||||
'position' => $this->position, |
|
||||||
'correct_answer' => $this->correct_answer, |
|
||||||
'other_answers' => $this->other_answers, |
|
||||||
]; |
|
||||||
} |
|
||||||
} |
|
@ -1,24 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
namespace App\Http\Resources; |
|
||||||
|
|
||||||
use Illuminate\Http\Request; |
|
||||||
use Illuminate\Http\Resources\Json\JsonResource; |
|
||||||
|
|
||||||
class ChoiceResource extends JsonResource |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Transform the resource into an array. |
|
||||||
* |
|
||||||
* @return array<string, mixed> |
|
||||||
*/ |
|
||||||
public function toArray(Request $request): array |
|
||||||
{ |
|
||||||
return [ |
|
||||||
'id' => $this->id, |
|
||||||
'content' => $this->content, |
|
||||||
'is_correct' => $this->is_correct, |
|
||||||
'position' => $this->position, |
|
||||||
]; |
|
||||||
} |
|
||||||
} |
|
@ -1,27 +0,0 @@ |
|||||||
<?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')), |
|
||||||
]; |
|
||||||
} |
|
||||||
} |
|
@ -1,23 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
namespace App\Http\Resources; |
|
||||||
|
|
||||||
use Illuminate\Http\Request; |
|
||||||
use Illuminate\Http\Resources\Json\JsonResource; |
|
||||||
|
|
||||||
class QuestionGroupResource extends JsonResource |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Transform the resource into an array. |
|
||||||
* |
|
||||||
* @return array<string, mixed> |
|
||||||
*/ |
|
||||||
public function toArray(Request $request): array |
|
||||||
{ |
|
||||||
return [ |
|
||||||
'id' => $this->id, |
|
||||||
'content' => $this->content, |
|
||||||
'questions' => QuestionResource::collection($this->whenLoaded('questions')), |
|
||||||
]; |
|
||||||
} |
|
||||||
} |
|
@ -1,25 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
namespace App\Http\Resources; |
|
||||||
|
|
||||||
use Illuminate\Http\Resources\Json\JsonResource; |
|
||||||
|
|
||||||
class QuestionResource extends JsonResource |
|
||||||
{ |
|
||||||
public function toArray($request) |
|
||||||
{ |
|
||||||
return [ |
|
||||||
'id' => $this->id, |
|
||||||
'content' => $this->content, |
|
||||||
'score' => $this->score, |
|
||||||
'explanation' => $this->explanation, |
|
||||||
'hint' => $this->hint, |
|
||||||
'type' => [ |
|
||||||
'code' => $this->type->code ?? null, |
|
||||||
'name' => $this->type->name ?? null, |
|
||||||
], |
|
||||||
'choices' => $this->when($this->type->code === 'multiple_choice', ChoiceResource::collection($this->choices)), |
|
||||||
'blanks' => $this->when($this->type->code !== 'multiple_choice', BlankResource::collection($this->blanks)), |
|
||||||
]; |
|
||||||
} |
|
||||||
} |
|
@ -1,22 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
namespace App\Http\Resources; |
|
||||||
|
|
||||||
use Illuminate\Http\Request; |
|
||||||
use Illuminate\Http\Resources\Json\JsonResource; |
|
||||||
|
|
||||||
class SkillResource extends JsonResource |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Transform the resource into an array. |
|
||||||
* |
|
||||||
* @return array<string, mixed> |
|
||||||
*/ |
|
||||||
public function toArray(Request $request): array |
|
||||||
{ |
|
||||||
return [ |
|
||||||
'id' => $this->id, |
|
||||||
'name' => $this->name |
|
||||||
]; |
|
||||||
} |
|
||||||
} |
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue