You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
832 B

<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class CarMan extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
$type_txt = [1 => '车主', 2 => '被保险人', 3 => '联系人'];
return [
'id' => $this->id,
'car_id' => $this->car_id,
'type' => $this->type,
'type_txt' => $type_txt[$this->type],
'name' => $this->name,
'phone' => $this->phone,
'id_card_type' => $this->id_card_type,
'id_card' => $this->id_card,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
}
}