Created API endpoints

This commit is contained in:
2017-12-20 16:45:20 +07:00
parent ad11643854
commit 554c74481b
53 changed files with 4637 additions and 9 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\Resource;
class QuestionResource extends Resource
{
/**
* Transform the resource collection into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
// return parent::toArray($request);
return [
'id' => $this->id,
'text' => $this->text,
'number' => $this->number,
'description' => $this->description,
'section' => new SectionResource($this->section),
'links' => [
'self' => route('questions.show', ['questions' => $this->id])
]
];
}
}