Beispiel #1
0
 public function getCompanyId(CompanyService $company, $user_id)
 {
     $retrieve = ['company_name'];
     try {
         $input = Request::only($retrieve);
         if (isset($input['company_name']) && !empty($input['company_name'])) {
             $company_id = $company->getCompanyByName($input['company_name'])['id'];
         } else {
             $company_id = $company->getCompanyByUserId($user_id)['id'];
         }
         return $this->json_response->success($company_id);
     } catch (Exception $e) {
         return $this->json_response->error(['error' => $e->getMessage()]);
     }
 }