Created API endpoints
This commit is contained in:
28
app/Http/Resources/QuestionchoiceResource.php
Normal file
28
app/Http/Resources/QuestionchoiceResource.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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])
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user