mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
33 lines
806 B
PHP
33 lines
806 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class VoucherCampaignResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
$metadata = null;
|
|
if ($request->has('include_metadata')) {
|
|
$metadata = KeyValueBasicResource::collection($this->attributesKVP()->latest()->get());
|
|
}
|
|
|
|
return [
|
|
// 'id' => $this->id,
|
|
'campaign_id' => $this->campaign_id,
|
|
'name' => $this->name,
|
|
'description' => $this->description,
|
|
'limit_per_month' => $this->limit_per_month,
|
|
'metadata' => $metadata
|
|
];
|
|
}
|
|
}
|