1
0

first commit

This commit is contained in:
2020-08-06 15:36:28 +08:00
commit fe5c11976c
12348 changed files with 1411979 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class PolicyListResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
$user = \Auth::guard('api')->user();
return [
'id' => $this->id,
'title' => $this->title,
'created_at' => $this->created_at->format('Y-m-d '),
'isFavorited' => $this->isFavoritedBy($user),
'type' => 'policy',
'area_id' => $this->areas()->pluck('china_area_id'),
];
}
}