mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-22 14:04:01 +00:00
56 lines
1.6 KiB
PHP
56 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Bookings\ControllersLogic;
|
|
|
|
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Classes\Modules\Bookings\Processors\ApprovePurchaseOrderProcessor;
|
|
use App\Classes\Modules\Bookings\Services\FetchesBooking;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ApprovePurchaseOrderLogic extends AbstractControllerLogic
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification():array {
|
|
return [
|
|
'title' => 'Purchase Order Approval',
|
|
'message' => 'You have successfully updated the Purchase order status'
|
|
];
|
|
}
|
|
|
|
/** @var FetchesBooking */
|
|
private $fetchesBooking;
|
|
|
|
/** @var ApprovePurchaseOrderProcessor */
|
|
private $approvePurchaseOrderProcessor;
|
|
|
|
/**
|
|
* ApprovePurchaseOrderLogic constructor.
|
|
* @param FetchesBooking $fetchesBooking
|
|
* @param ApprovePurchaseOrderProcessor $approvePurchaseOrderProcessor
|
|
*/
|
|
public function __construct(ApprovePurchaseOrderProcessor $approvePurchaseOrderProcessor, FetchesBooking $fetchesBooking)
|
|
{
|
|
$this->approvePurchaseOrderProcessor = $approvePurchaseOrderProcessor;
|
|
$this->fetchesBooking = $fetchesBooking;
|
|
}
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return JsonResponse
|
|
* @throws \App\Classes\Exceptions\MalformedRequestException
|
|
*/
|
|
public function logic(Request $request) : JsonResponse
|
|
{
|
|
$booking = $this->fetchesBooking->execute(['id' => $request->route('id')]);
|
|
|
|
$this->approvePurchaseOrderProcessor->execute($booking);
|
|
|
|
return $this->response([]);
|
|
}
|
|
}
|