mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-09-01 02:43:58 +00:00
53 lines
1.6 KiB
PHP
53 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Vouchers\ControllersLogic;
|
|
|
|
use App\Classes\Modules\Vouchers\DataTransferObjects\UpdateVoucherEndDateObject;
|
|
use App\Classes\Modules\Vouchers\Services\UpdatesVoucherEndDate;
|
|
use App\Classes\Modules\Vouchers\Standards\Rules\CanUpdateVoucherEndDate;
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class UpdateVoucherEndDateLogic extends AbstractControllerLogic
|
|
{
|
|
/** @var UpdatesVoucherEndDate */
|
|
private $updatesVoucherEndDate;
|
|
|
|
/** @var CanUpdateVoucherEndDate */
|
|
private $canUpdateVoucherEndDate;
|
|
|
|
/**
|
|
* UpdateVoucherEndDateLogic constructor.
|
|
* @param UpdatesVoucherEndDate $updatesVoucherEndDate
|
|
* @param CanUpdateVoucherEndDate $canUpdateVoucherEndDate
|
|
*/
|
|
|
|
public function __construct(UpdatesVoucherEndDate $updatesVoucherEndDate, CanUpdateVoucherEndDate $canUpdateVoucherEndDate)
|
|
{
|
|
$this->updatesVoucherEndDate = $updatesVoucherEndDate;
|
|
$this->canUpdateVoucherEndDate = $canUpdateVoucherEndDate;
|
|
}
|
|
|
|
protected function notification(): array
|
|
{
|
|
return [
|
|
'title' => 'Updated Voucher End Date',
|
|
'message' => 'The selected voucher end date has been updated.'
|
|
];
|
|
}
|
|
|
|
public function logic(Request $request): JsonResponse
|
|
{
|
|
$object = new UpdateVoucherEndDateObject(
|
|
$request->input('id'),
|
|
$request->input('end_date')
|
|
);
|
|
$this->canUpdateVoucherEndDate->passes($object);
|
|
|
|
$voucher = $this->updatesVoucherEndDate->execute($object);
|
|
|
|
return $this->response([]);
|
|
}
|
|
}
|