29 lines
669 B
PHP
29 lines
669 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\Resource;
|
|
|
|
class QuestionchoiceResource extends Resource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'number' => $this->number,
|
|
'text' => $this->text,
|
|
'fillable' => $this->fillable,
|
|
'description' => $this->description,
|
|
'links' => [
|
|
'relatedTo' => route('questions.show', ['questions' => $this->question_id])
|
|
]
|
|
];
|
|
}
|
|
}
|