当前位置: 首页>>代码示例>>PHP>>正文


PHP Manager::beginTransaction方法代码示例

本文整理汇总了PHP中Illuminate\Database\Capsule\Manager::beginTransaction方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::beginTransaction方法的具体用法?PHP Manager::beginTransaction怎么用?PHP Manager::beginTransaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Database\Capsule\Manager的用法示例。


在下文中一共展示了Manager::beginTransaction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: joinCaStore

 public function joinCaStore($referral)
 {
     $request = $this->request->request;
     $this->fillParticipants("vks_participants_create", $this->request);
     $report = new VksReport($request);
     $this->validator->validate(['ФИО ответственного' => [$request->get('init_customer_fio'), 'required|max(255)'], 'Почта ответственного' => [$request->get('init_customer_mail'), 'required|max(255)'], 'Тел. ответственного' => [$request->get('init_customer_phone'), 'required|max(255)'], 'Подразделение' => [$request->get('department'), 'required|int'], 'Кол-во участников с рабочих мест (IP телефоны)' => [$request->get('in_place_participants_count'), 'int'], 'Участники ВКС' => [$request->get('inner_participants'), 'array'], 'Точка для технической поддержки' => [$request->get('tech_support_att_id'), "int|attendance_is_tech_supportable"], 'Комментарий для Тех. поддержки' => [$request->get('user_message'), 'max(255)'], 'Комментарий для Администратора' => [$request->get('comment_for_admin'), 'max(255)']]);
     //if no passes
     if (!$this->validator->passes()) {
         $this->backWithData($this->validator->errors()->all());
     }
     //any participants required
     if (!intval($request->get('in_place_participants_count')) && !count($request->get('inner_participants'))) {
         $this->backWithData('Вы не выбрали участников для ВКС');
     }
     Capsule::beginTransaction();
     $caWS = CAVks::where('referral', $referral)->with('connection_codes')->first();
     $caNS = CAVksNoSupport::where('referral', $referral)->first();
     if (!$caWS && !$caNS) {
         $this->backWithData("Приглашение {$request->get('referrer')}  не действительно");
     }
     $caVKSType = $caWS ? VKS_WAS : VKS_NS;
     $caVks = $caWS ? $caWS : $caNS;
     $this->convertToLocalTime($caVks);
     $vks = new Vks();
     $vks->is_private = $request->has('is_private') ? 1 : 0;
     $vks->record_required = $request->has('record_required') ? 1 : 0;
     $vks->title = $caVks->title;
     $vks->date = $caVks->local->start_date_time->format("Y-m-d");
     $vks->start_date_time = $caVks->local->start_date_time;
     $vks->end_date_time = $caVks->local->end_date_time;
     $vks->presentation = isset($caVks->presentation) ? $caVks->presentation : 0;
     $vks->department = $request->get('department');
     $vks->initiator = 1;
     //always CA
     $vks->init_customer_fio = $request->get('init_customer_fio');
     $vks->init_customer_phone = $request->get('init_customer_phone');
     $vks->init_customer_mail = $request->get('init_customer_mail');
     $vks->comment_for_admin = $request->get('comment_for_admin');
     $vks->link_ca_vks_id = $caVks->id;
     $vks->link_ca_vks_type = $caVKSType;
     $vks->owner_id = App::$instance->user->id;
     $vks->from_ip = App::$instance->user->ip;
     $vks->ca_code = isset($caVks->connectionCode->value) ? $caVks->connectionCode->value : $caVks->v_room_num;
     $vks->in_place_participants_count = $request->get('in_place_participants_count');
     //        die(dump($vks));
     $vks->save();
     if ($request->get('tech_support_required')) {
         TechSupportRequest::create(array('att_id' => $request->get('tech_support_att_id'), 'vks_id' => $vks->id, 'owner_id' => App::$instance->user->id, 'user_message' => $request->get('user_message'), 'status' => TechSupportRequest::STATUS_WAIT_VKS_DECISION));
     }
     if (!Auth::isAdmin(App::$instance)) {
         if (self::isVksInPastTime($vks)) {
             throw new LogicException('bad vks date, it on past time');
         }
     }
     //create participants
     $this->createInnerOrPhoneParp($request->get('inner_participants'), $vks);
     App::$instance->log->logWrite(LOG_VKSWS_CREATED, "VKS " . ST::linkToVksPage($vks->id) . " Created");
     Capsule::commit();
     //refill for report
     $this->request->request->set("date", $vks->date->format("d.m.Y"));
     $this->request->request->set("start_time", $vks->start_date_time->format("H:i"));
     $this->request->request->set("end_time", $vks->end_date_time->format("H:i"));
     $report->setObject($vks);
     $report->setResult(true);
     $result[] = $report;
     $_SESSION['savedResult_' . App::$instance->main->appkey] = $result;
     ST::redirectToRoute('vks/checkout');
 }
开发者ID:inilotic,项目名称:vks_nodes_core,代码行数:68,代码来源:Vks_controller.php


注:本文中的Illuminate\Database\Capsule\Manager::beginTransaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。