'Update Company Details', 'message' => 'You have successfully updated the Company Details' ]; } /** @var FetchesCompany */ private $fetchesCompany; /** @var UpdatesCompanyProfile */ private $updatesCompanyProfile; /** * UpdateCompanyProfileLogic constructor. * @param FetchesCompany $fetchesCompany * @param UpdatesCompanyProfile $updatesCompanyProfile */ public function __construct( FetchesCompany $fetchesCompany, UpdatesCompanyProfile $updatesCompanyProfile ) { $this->fetchesCompany = $fetchesCompany; $this->updatesCompanyProfile = $updatesCompanyProfile; } /** * @param Request $request * @return JsonResponse * @throws \App\Classes\Exceptions\AccessForbiddenException * @throws \App\Classes\Exceptions\MalformedRequestException * @throws \App\Classes\Exceptions\RequestValidationException */ public function logic(Request $request) : JsonResponse { $object = new CompanyProfileObject($request->input('email'), $request->input('phone'), $request->input('type')); $company = $this->fetchesCompany->execute(['id' => $request->route('id')]); $company_query = $this->updatesCompanyProfile->execute($company, $object); return $this->resourceResponse(new CompanyResource($company_query)); } }