29 lines
694 B
PHP
29 lines
694 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\Resource;
|
|
|
|
class QuestionnaireResource extends Resource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
// return parent::toArray($request);
|
|
return [
|
|
'id' => $this->id,
|
|
'category' => new CategoryResource($this->category),
|
|
'title' => $this->title,
|
|
'description' => $this->description,
|
|
'links' => [
|
|
'self' => route('questionnaires.show', ['questionnaires' => $this->id])
|
|
]
|
|
];
|
|
}
|
|
}
|