SHARE
TWEET

Untitled

a guest Apr 26th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function export(Request $request)
  2.     {
  3.         $application = Application::findOrFail($request->id);
  4.         try {
  5.             $client = new SoapClient(config('app.address_1c')); //для 1с
  6.             $status = 'Ошибка определения статуса';
  7.             switch ($application->status) {
  8.                 case 0:
  9.                     $status = 'Не проверена';
  10.                     break;
  11.                 case 1:
  12.                     $status = 'Принята';
  13.                     break;
  14.                 case 2:
  15.                     $status = 'Отклонена';
  16.                     break;
  17.             }
  18.             $data = array(
  19.                 'first_name' => $application->first_name,
  20.                 'middle_name' => $application->middle_name,
  21.                 'last_name' => $application->last_name,
  22.                 'post_id' => $application->post->name,
  23.                 'passport_id' => $application->passport_id,
  24.                 'employment_history' => $application->employment_history,
  25.                 'snils' => $application->snils,
  26.                 'inn' => $application->inn,
  27.                 'scientific_works' => $application->scientific_works,
  28.                 'email' => $application->email,
  29.                 'status' => $status,
  30.                 'description' => $application->description);
  31.  
  32.             $result = $client->SendApplication($data);
  33.             return response()->json(['message' => 'Успешно отправлено в БД 1С', 'code' => $result->return]);
  34.         } catch (Exception $error) {
  35.             Debugbar::info($error);
  36.             return response()->json(['message' => 'Ошибка сохранения в 1С', 'code' => 500]);
  37.         }
  38.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top