UserTransformer.php 588 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<?php

namespace Modules\User\Transformers;

use Illuminate\Http\Resources\Json\Resource;

class UserTransformer extends Resource
{
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'first_name' => $this->first_name,
            'last_name' => $this->last_name,
            'fullname' => $this->present()->fullname,
            'email' => $this->email,
            'created_at' => $this->created_at,

            'urls' => [
20
                'delete_url' => route('api.user.user.destroy', $this->id),
21 22 23 24
            ],
        ];
    }
}