'Retrieved Company', 'message' => 'You have successfully retrieved a Company' ]; } /** @var CanFetchCompany */ private $canFetchCompany; /** @var FetchesCompany */ private $fetchesCompany; /** * FetchCompanyControllersLogic constructor. * @param CanFetchCompany $canFetchCompany * @param FetchesCompany $fetchesCompany */ public function __construct(CanFetchCompany $canFetchCompany, FetchesCompany $fetchesCompany) { $this->canFetchCompany = $canFetchCompany; $this->fetchesCompany = $fetchesCompany; } /** * @param Request $request * @return JsonResponse * @throws \App\Classes\Exceptions\AccessForbiddenException * @throws \App\Classes\Exceptions\RequestValidationException */ public function logic(Request $request) : JsonResponse { $this->canFetchCompany->passes(); $query = $this->fetchesCompany->execute(['id' => $request->route('id'), 'with_bookings' => true, 'with_wallets' => true]); return $this->resourceResponse(new CompanyResource($query)); } }