36 lines
993 B
PHP
36 lines
993 B
PHP
<?php
|
|
|
|
namespace Modules\Task\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
use Jason\Api\Api;
|
|
|
|
class TaskResource extends JsonResource
|
|
{
|
|
|
|
public function toArray($request): array
|
|
{
|
|
$user = Api::user();
|
|
|
|
return [
|
|
'id' => $this->id,
|
|
'ico' => $this->ico_url,
|
|
'key' => $this->key,
|
|
'cover' => $this->cover_url,
|
|
'title' => $this->title,
|
|
'sub_title' => $this->sub_title,
|
|
'remark' => $this->remark,
|
|
'tips' => $this->tips,
|
|
'url' => $this->linker,
|
|
'category' => new CategoryResource($this->category),
|
|
'rule' => [
|
|
'id' => $this->rule->id,
|
|
'name' => $this->rule->name,
|
|
'title' => $this->rule->title,
|
|
],
|
|
'user' => $this->getUserTask($user),
|
|
'content' => $this->description,
|
|
];
|
|
}
|
|
|
|
} |