mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
61 lines
1.6 KiB
PHP
61 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Bookings\ControllersLogic;
|
|
|
|
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Classes\Modules\Bookings\Services\FetchesBooking;
|
|
use App\Classes\Modules\Bookings\Standards\Rules\CanFetchBooking;
|
|
use App\Http\Resources\BookingResource;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class FetchBookingLogic extends AbstractControllerLogic
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification():array {
|
|
return [
|
|
'title' => 'Retrieved Booking',
|
|
'message' => 'You have successfully retrieved a Address'
|
|
];
|
|
}
|
|
|
|
/** @var CanFetchBooking */
|
|
private $canFetchBooking;
|
|
|
|
/** @var FetchesBooking */
|
|
private $fetchesBooking;
|
|
|
|
/**
|
|
* FetchBookingLogic constructor.
|
|
* @param CanFetchBooking $canFetchBooking
|
|
* @param FetchesBooking $fetchesBooking
|
|
*/
|
|
public function __construct(CanFetchBooking $canFetchBooking, FetchesBooking $fetchesBooking)
|
|
{
|
|
$this->canFetchBooking = $canFetchBooking;
|
|
$this->fetchesBooking = $fetchesBooking;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return JsonResponse
|
|
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
|
* @throws \App\Classes\Exceptions\RequestValidationException
|
|
*/
|
|
public function logic(Request $request) : JsonResponse
|
|
{
|
|
|
|
$this->canFetchBooking->passes();
|
|
|
|
$query = $this->fetchesBooking->execute(['marking' => $request->route('marking'), 'with_transactions' => true]);
|
|
|
|
return $this->resourceResponse(new BookingResource($query));
|
|
|
|
}
|
|
|
|
} |