generated from liutk/owl-admin-base
37 lines
1.0 KiB
PHP
37 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Api;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
use Illuminate\Http\Response;
|
|
|
|
class ActivityResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'name' => $this->name,
|
|
'cover' => $this->cover ??'',
|
|
'rules' => nl2br($this->rules ??''),
|
|
'start_at' => $this->start_at->format('Y-m-d H:i'),
|
|
'end_at' => $this->end_at->format('Y-m-d H:i'),
|
|
'state' => $this->state,
|
|
'share_image'=> $this->share_image ?? '',
|
|
'share_title'=> $this->share_title ?? '',
|
|
|
|
'has_gift' => $this->when($this->has_gift !== null, $this->has_gift),
|
|
];
|
|
}
|
|
|
|
public function with($request)
|
|
{
|
|
return ['code' => Response::HTTP_OK, 'message' => ''];
|
|
}
|
|
} |