28 lines
842 B
PHP
28 lines
842 B
PHP
<?php
|
|
|
|
namespace Modules\User\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class UserCertificationResource extends JsonResource
|
|
{
|
|
|
|
public function toArray($request): array
|
|
{
|
|
return [
|
|
'certification_id' => $this->id,
|
|
'name' => $this->name,
|
|
'verified' => (bool) $this->verified,
|
|
'id_card' => $this->id_card,
|
|
'front_card' => $this->when($this->front_card, function () {
|
|
return Storage::url($this->front_card);
|
|
}),
|
|
'back_card' => $this->when($this->back_card, function () {
|
|
return Storage::url($this->back_card);
|
|
}),
|
|
'created_at' => (string) $this->created_at,
|
|
];
|
|
}
|
|
|
|
} |