mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
[api] reward + thanks
This commit is contained in:
28
app/Http/Resources/PollResource.php
Normal file
28
app/Http/Resources/PollResource.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class PollResource extends JsonResource
|
||||
{
|
||||
public $preserveKeys = true;
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$out = [
|
||||
'id' => $this->id,
|
||||
'added' => format_datetime($this->added),
|
||||
'question' => $this->question,
|
||||
'answers_count' => $this->answers_count,
|
||||
'options' => $this->options,
|
||||
];
|
||||
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user