mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
46 lines
1.6 KiB
PHP
46 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Vouchers\ControllersLogic;
|
|
|
|
use App\Classes\Modules\Vouchers\DataTransferObjects\UpdateVoucherCampaignEndDateObject;
|
|
use App\Classes\Modules\Vouchers\Services\UpdatesVoucherCampaignEndDate;
|
|
use App\Classes\Modules\Vouchers\Standards\Rules\CanUpdateVoucherCampaignEndDate;
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Http\Resources\VoucherCampaignResource;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class UpdateVoucherCampaignEndDateLogic extends AbstractControllerLogic
|
|
{
|
|
/**
|
|
* UpdateVoucherCampaignEndDateLogic constructor.
|
|
* @param UpdatesVoucherCampaignEndDate $updatesVoucherCampaignEndDate
|
|
* @param CanUpdateVoucherCampaignEndDate $canUpdateVoucherCampaignEndDate
|
|
*/
|
|
public function __construct(private UpdatesVoucherCampaignEndDate $updatesVoucherCampaignEndDate, private CanUpdateVoucherCampaignEndDate $canUpdateVoucherCampaignEndDate)
|
|
{
|
|
}
|
|
|
|
protected function notification(): array
|
|
{
|
|
return [
|
|
'title' => 'Updated Voucher Campaign End Date',
|
|
'message' => 'The selected voucher campaign end date has been updated.'
|
|
];
|
|
}
|
|
|
|
public function logic(Request $request): JsonResponse
|
|
{
|
|
$object = new UpdateVoucherCampaignEndDateObject(
|
|
$request->input('campaign_id'),
|
|
$request->input('end_date')
|
|
);
|
|
|
|
$this->canUpdateVoucherCampaignEndDate->passes($object);
|
|
|
|
$campaign = $this->updatesVoucherCampaignEndDate->execute($object);
|
|
|
|
return $this->response([]);
|
|
}
|
|
}
|