mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Sorry Voucher with new features enhancement requested by KS
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Vouchers;
|
||||
|
||||
|
||||
use App\Classes\Modules\Vouchers\ControllersLogic\ListVoucherCampaignsLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListVoucherCampaignsController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListVoucherCampaignsLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function list(Request $request, ListVoucherCampaignsLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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->attributes);
|
||||
}
|
||||
|
||||
return [
|
||||
// 'id' => $this->id,
|
||||
'campaign_id' => $this->campaign_id,
|
||||
'name' => $this->name,
|
||||
'description' => $this->description,
|
||||
'limit_per_month' => $this->limit_per_month,
|
||||
'metadata' => $metadata
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user