/** * @author EA * @param Request $request * @param int $location * @return array|\Illuminate\Http\Response */ public function setProfileEmployment(Request $request, $location) { /** @var Location $location */ $location = Location::findOrFail($location)->first(); try { return $this->profileGateway->setEmployment((int) $request->get('user'), ['employment_status' => (int) $request->get('employment_status'), 'employment_start' => (string) $request->get('employment_start'), 'phone_employer' => (string) $request->get('phone_employer')], $location->installation->merchant->token); } catch (\Exception $e) { $this->logError('Setting Employment Failed: ' . $e->getMessage(), $request->all()); return $this->apiResponseFromException($e, 422); } }