32 lines
760 B
PHP
32 lines
760 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Helpers\DateHelper;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
/**
|
|
* @mixin \App\Models\Vault
|
|
*/
|
|
class VaultResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
*/
|
|
public function toArray($request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'name' => $this->name,
|
|
'description' => $this->description,
|
|
'created_at' => DateHelper::getTimestamp($this->created_at),
|
|
'updated_at' => DateHelper::getTimestamp($this->updated_at),
|
|
'links' => [
|
|
'self' => route('api.vaults.show', $this),
|
|
],
|
|
];
|
|
}
|
|
}
|