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


PHP Participant::save方法代码示例

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


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

示例1: run

 public function run()
 {
     $participants = DB::table('event_participant')->get();
     foreach ($participants as $participant) {
         $player = Player::find($participant->player_id);
         $user = User::find($participant->user_id);
         $event = Evento::find($participant->event_id);
         $payment = Payment::find($participant->payment_id);
         $uuid = Uuid::generate();
         $new = new Participant();
         $new->id = $uuid;
         $new->firstname = $player->firstname;
         $new->lastname = $player->lastname;
         $new->due = $event->getOriginal('fee');
         $new->early_due = $event->getOriginal('early_fee');
         $new->early_due_deadline = $event->early_deadline;
         $new->method = 'full';
         $new->plan_id = Null;
         $new->player_id = $player->id;
         $new->event_id = $participant->event_id;
         $new->accepted_on = $participant->created_at;
         $new->accepted_by = $user->profile->firstname . " " . $user->profile->lastname;
         $new->accepted_user = $participant->user_id;
         $new->status = 1;
         $new->created_at = $participant->created_at;
         $new->updated_at = $participant->updated_at;
         $new->save();
         $update = Item::where('payment_id', '=', $payment->id)->firstOrFail();
         $update->participant_id = $uuid;
         $update->save();
     }
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:32,代码来源:FollowersTableSeeder.php

示例2: updateDetails

 public function updateDetails()
 {
     if (Session::has('sense')) {
         $cId = Session::get('sense')[1];
         $tmp = Participant::where('cId', $cId);
         $phone = Input::get('pPhone');
         if ($tmp) {
             $tmp->delete();
         }
         foreach (Input::get('pName') as $key => $name) {
             if (strlen($name) > 0) {
                 $p = new Participant();
                 $p->cId = $cId;
                 $p->pid = $key + 1;
                 $p->name = $name;
                 if (strlen($phone[$key]) > 0) {
                     $p->phone = $phone[$key];
                 }
                 $p->save();
             }
         }
         return Redirect::to('member/coll');
     }
     return Redirect::to('reg');
 }
开发者ID:bullbuxter,项目名称:anandotsava.in,代码行数:25,代码来源:CollegeController.php

示例3: updateDetails

 public function updateDetails()
 {
     if (Session::has('collId')) {
         $cId = Session::get('collId');
         $tmp = Participant::where('cId', $cId);
         $phone = Input::get('pPhone');
         $destination = getcwd() . "\\public\\img\\participants\\";
         if ($tmp) {
             $tmp->delete();
         }
         foreach (Input::get('pName') as $key => $name) {
             if (strlen($name) > 0) {
                 $p = new Participant();
                 $p->cId = $cId;
                 $p->pid = $key + 1;
                 $p->name = $name;
                 if (strlen($phone[$key]) > 0) {
                     $p->phone = $phone[$key];
                 }
                 $p->save();
             }
         }
         for ($i = 0; $i < sizeof(Input::file('image')); $i++) {
             if (Input::hasFile('image')) {
                 $file = Input::file('image');
                 $filename = "myfile" . $i . "." . $file[$i]->getClientOriginalExtension();
                 $flag = $file[$i]->move($destination, $filename);
             }
         }
         return Redirect::to('member');
     }
     return Redirect::to('reg');
 }
开发者ID:vishwasnavadak,项目名称:anandotsava.in,代码行数:33,代码来源:CollegeController.php

示例4: select_group

 public function select_group()
 {
     $group_id = $this->input->post('group_id');
     $this->_transaction_isolation();
     $this->db->trans_begin();
     $group = new Group();
     $group->get_by_id($group_id);
     if ($group->exists()) {
         $course = $group->course->get();
         if (is_null($course->groups_change_deadline) || date('U', strtotime($course->groups_change_deadline)) >= time()) {
             $student = new Student();
             $student->get_by_id($this->usermanager->get_student_id());
             if ($student->is_related_to('active_course', $course->id)) {
                 $participant = new Participant();
                 $participant->where_related($student);
                 $participant->where_related($course);
                 $participant->where('allowed', 1);
                 $participant->get();
                 if ($participant->exists()) {
                     if (!$participant->is_related_to($group)) {
                         $participant->save($group);
                         $participant->where_related($course);
                         $participant->where_related($group);
                         $participant->where('allowed', 1);
                         $participants_count = $participant->count();
                         $room = new Room();
                         $room->where_related($group)->order_by('capacity', 'asc')->limit(1)->get();
                         if ($participants_count > intval($room->capacity)) {
                             $this->db->trans_rollback();
                             $this->messages->add_message('lang:groups_message_group_is_full', Messages::MESSAGE_TYPE_ERROR);
                         } else {
                             $this->db->trans_commit();
                             $this->messages->add_message(sprintf($this->lang->line('groups_message_group_changed'), $this->lang->text($group->name)), Messages::MESSAGE_TYPE_SUCCESS);
                             $this->_action_success();
                             $this->output->set_internal_value('course_id', $participant->course_id);
                         }
                     } else {
                         $this->db->trans_rollback();
                         $this->messages->add_message('lang:groups_message_you_are_in_group', Messages::MESSAGE_TYPE_ERROR);
                     }
                 } else {
                     $this->db->trans_rollback();
                     $this->messages->add_message('lang:groups_message_cant_found_participant_record', Messages::MESSAGE_TYPE_ERROR);
                 }
             } else {
                 $this->db->trans_rollback();
                 $this->messages->add_message('lang:groups_message_cant_change_group_of_inactive_course', Messages::MESSAGE_TYPE_ERROR);
             }
         } else {
             $this->db->trans_rollback();
             $this->messages->add_message('lang:groups_message_groups_switching_disabled', Messages::MESSAGE_TYPE_ERROR);
         }
     } else {
         $this->db->trans_rollback();
         $this->messages->add_message('lang:groups_message_group_not_found', Messages::MESSAGE_TYPE_ERROR);
     }
     redirect(create_internal_url('groups'));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:58,代码来源:groups.php

示例5: store

 public static function store()
 {
     self::check_admin_logged_in();
     $attributes = self::get_attributes();
     $participant = new Participant($attributes);
     $errors = $participant->errors();
     if (count($errors) == 0) {
         $participant->save();
         Redirect::to('/competition/' . $participant->competition_id . '/participants', array('message' => 'Kilpailija lisätty kilpailuun'));
     } else {
         self::creation_view(array(Competition::find($participant->competition_id)), Competitor::all(), true, $errors);
     }
 }
开发者ID:eerojala,项目名称:Hiihtokilpailujen-tulospalvelu,代码行数:13,代码来源:participant_controller.php

示例6: afterSave

 protected function afterSave($wasNew)
 {
     if (!$wasNew && $this->updateRelatedParticipants && $this->isModified('status')) {
         $stmt = $this->getRelatedParticipants();
         foreach ($stmt as $participant) {
             $participant->updateRelatedParticipants = false;
             //prevent endless loop. Because it will also process this aftersave
             $participant->event->touch();
             // Touch the event to update its mtime.
             $participant->status = $this->status;
             $participant->save();
         }
         //$this->event->touch(); // Touch the event to update the modification date.
     }
     if ($wasNew && $this->event->is_organizer) {
         //add this participant to each existing event.
         if (!$this->dontCreateEvent && $this->user_id > 0 && !$this->is_organizer) {
             //			if ($this->user_id > 0 && !$this->is_organizer) {
             $newEvent = $this->event->createCopyForParticipant($this);
         }
         $stmt = $this->event->getRelatedParticipantEvents();
         foreach ($stmt as $event) {
             if (empty($newEvent) || $event->id != $newEvent->id) {
                 $p = Participant::model()->findSingleByAttributes(array('event_id' => $event->id, 'email' => $this->email));
                 if (!$p) {
                     $p = new Participant();
                     $p->setAttributes($this->getAttributes('raw'), false);
                     $p->event_id = $event->id;
                     $p->id = null;
                     $p->save();
                 }
             }
         }
         if (!$this->is_organizer && $this->contact) {
             $this->contact->link($this->event);
         }
     }
     return parent::afterSave($wasNew);
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:39,代码来源:Participant.php

示例7: store

 /**
  * Store a newly created resource in storage.
  * POST /participant
  *
  * @return Response
  */
 public function store($id)
 {
     $user = Auth::user();
     $club = $user->Clubs()->FirstOrFail();
     $event = Evento::Find($id);
     $player = Player::Find(Input::get('player'));
     $uuid = Uuid::generate();
     $input = Input::all();
     $messages = array('player.required' => 'Please select at least one player');
     $validator = Validator::make(Input::all(), Participant::$rules, $messages);
     $validator->sometimes(array('fee', 'early_fee', 'early_deadline'), 'required', function ($input) {
         return $input->fee != '';
     });
     $validator->sometimes(array('fee', 'early_fee', 'early_deadline'), 'required', function ($input) {
         return $input->early_fee != '';
     });
     $validator->sometimes(array('fee', 'early_fee', 'early_deadline'), 'required', function ($input) {
         return $input->early_deadline != '';
     });
     $validator->sometimes(array('fee', 'early_fee', 'early_deadline'), 'required', function ($input) {
         return $input->plan_id != '';
     });
     if (empty(Input::get('fee'))) {
         $fee = $event->getOriginal('fee');
     } else {
         $fee = Input::get('fee');
     }
     if (empty(Input::get('early_fee'))) {
         $early_fee = $event->getOriginal('early_fee');
     } else {
         $early_fee = Input::get('early_fee');
     }
     if (empty(Input::get('early_deadline'))) {
         $early_deadline = $event->early_due_deadline;
     } else {
         $early_deadline = Input::get('early_deadline');
     }
     if (empty(Input::get('plan_id'))) {
         $plan_id = $event->plan_id;
     } else {
         $plan_id = Input::get('plan_id');
     }
     if (Input::get('fee') == '0') {
         $fee = 0;
         $plan_id = null;
     }
     if (Input::get('fee') > 0) {
         $plan_id = Input::get('plan_id');
     }
     if ($validator->passes()) {
         $participant = new Participant();
         $participant->id = $uuid;
         $participant->firstname = $player->firstname;
         $participant->lastname = $player->lastname;
         $participant->due = $fee;
         $participant->early_due = $early_fee;
         $participant->early_due_deadline = $early_deadline;
         $participant->plan_id = $plan_id;
         $participant->player_id = $player->id;
         $participant->event_id = $event->id;
         $status = $participant->save();
         if ($status) {
             $participant = Participant::find($uuid);
             //send email notification of acceptance
             $data = array('club' => $club, 'player' => $player, 'user' => $user, 'participant' => $participant);
             $mail = Mail::send('emails.notification.event.invite', $data, function ($message) use($user, $club, $participant) {
                 $message->from('C2C@leaguetogether.com', 'C2C Lacrosse')->to($participant->player->user->email, $participant->accepted_by)->subject("You're Invited to join our event | " . $club->name);
             });
             return Redirect::action('EventoController@show', $event->id)->with('notice', 'Player added successfully');
         } else {
             $error = $status->errors()->all(':message');
             return Redirect::back()->withInput()->withErrors($error);
         }
     }
     $error = $validator->errors()->all(':message');
     return Redirect::back()->withInput()->withErrors($error);
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:83,代码来源:ParticipantController.php

示例8: change_group

 public function change_group($participant_id)
 {
     $group_id = $this->input->post('group_id');
     $this->_transaction_isolation();
     $this->db->trans_begin();
     $participant = new Participant();
     $participant->get_by_id($participant_id);
     $group = new Group();
     $group->get_by_id($group_id);
     $course = $participant->course->get();
     if ($group->exists()) {
         if ($group->is_related_to($course)) {
             $participant->save($group);
         }
     } else {
         $current_group = $participant->group->get();
         $participant->delete($current_group);
     }
     $is_ok = TRUE;
     if ($group->exists()) {
         if ($participant->allowed == 1) {
             $group_for_test = new Group();
             $rooms = $group_for_test->room;
             $rooms->select_min('capacity');
             $rooms->where('group_id', '${parent}.id', FALSE);
             $group_for_test->select_subquery($rooms, 'group_capacity');
             $group_for_test->include_related_count('participant');
             $group_for_test->where_related_participant('allowed', 1);
             $group_for_test->get_by_id(intval($participant->group_id));
             if ($group_for_test->exists()) {
                 if (intval($group_for_test->participant_count) > intval($group_for_test->group_capacity)) {
                     $is_ok = FALSE;
                 }
             }
         }
     }
     if ($is_ok && $this->db->trans_status()) {
         $this->db->trans_commit();
         $this->_action_success();
         $this->output->set_internal_value('student_id', $participant->student_id);
         $this->output->set_internal_value('course_id', $participant->course_id);
     } else {
         $this->db->trans_rollback();
     }
     $participant->include_related('group', 'name');
     $participant->get_by_id($participant_id);
     $this->parser->parse('backend/participants/group_column.tpl', array('participant' => $participant));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:48,代码来源:participants.php

示例9: store

 /**
 * Store a newly created resource in storage.
 * POST /payment
 *
 * @return Response
 */
 public function store()
 {
     $user = Auth::user();
     $param = array('customer_vault_id' => Input::get('vault'), 'discount' => Input::get('discount'));
     $payment = new Payment();
     $transaction = $payment->sale($param);
     if ($transaction->response == 3 || $transaction->response == 2) {
         return Redirect::action('PaymentController@create')->with('error', $transaction->responsetext);
     } else {
         $payment->user = $user->id;
         $payment->type = $transaction->type;
         $payment->transaction = $transaction->transactionid;
         $payment->subtotal = $transaction->subtotal;
         $payment->service_fee = $transaction->fee;
         $payment->total = $transaction->total;
         $payment->promo = $transaction->promo;
         $payment->tax = $transaction->tax;
         $payment->discount = $transaction->discount;
         $payment->save();
         if ($payment->id) {
             $club = "";
             foreach (Cart::contents() as $item) {
                 $salesfee = $item->price / getenv("SV_FEE") - $item->price;
                 $sale = new Item();
                 $sale->description = $item->name;
                 $sale->club_id = $item->org_id;
                 $sale->quantity = $item->quantity;
                 $sale->price = $item->price;
                 $sale->fee = $salesfee;
                 $sale->item = $item->event;
                 $sale->type = 1;
                 // $sale->discout	= ;
                 Payment::find($payment->id)->Items()->save($sale);
                 if ($item->player_id) {
                     foreach ($item->player_id as $key => $playerid) {
                         $participant = new Participant();
                         $participant->event = $item->event;
                         $participant->user = $user->id;
                         $participant->player = $playerid;
                         $participant->payment = $payment->id;
                         $participant->save();
                     }
                 } else {
                     $participant = new Participant();
                     $participant->event = $item->event;
                     $participant->user = $user->id;
                     $participant->payment = $payment->id;
                     $participant->save();
                 }
                 $club[] = $item->org_id;
             }
         }
         //email receipt
         $payment->receipt($transaction, $club);
         return Redirect::action('PaymentController@success')->with('result', $transaction);
     }
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:63,代码来源:PaymentController.php

示例10: signup_to_course

 public function signup_to_course($course_id)
 {
     $this->output->set_content_type('application/json');
     $output = new stdClass();
     $output->status = FALSE;
     $output->message = '';
     $output->content = '';
     $this->_transaction_isolation();
     $this->db->trans_begin();
     $student = new Student();
     $student->get_by_id($this->usermanager->get_student_id());
     $course = new Course();
     $course->where('hide_in_lists', 0);
     $course->get_by_id($course_id);
     if ($course->exists()) {
         if ($course->is_subscription_allowed()) {
             if ($student->participant->where_related($course)->count() == 0) {
                 if ($course->auto_accept_students == 1) {
                     $participants = new Participant();
                     $participants->where_related_course($course);
                     $participants->where('allowed', 1);
                     $participants_count = $participants->count();
                     if ($participants_count >= (int) $course->capacity) {
                         $output->message = $this->lang->line('courses_message_course_is_full');
                         $output->status = FALSE;
                         $this->db->trans_rollback();
                     } else {
                         $participant = new Participant();
                         $participant->allowed = 1;
                         $participant->save(array($student, $course));
                         $this->db->trans_commit();
                         $output->message = sprintf($this->lang->line('courses_message_signed_up_for_course_approved'), $this->lang->text($course->name));
                         $this->parser->assign('course', $course);
                         $output->content = $this->parser->parse('frontend/courses/single_course.tpl', array(), TRUE);
                         $output->status = TRUE;
                         $this->_action_success();
                     }
                 } else {
                     $participant = new Participant();
                     $participant->allowed = 0;
                     $participant->save(array($student, $course));
                     $this->db->trans_commit();
                     $output->message = sprintf($this->lang->line('courses_message_signed_up_for_course'), $this->lang->text($course->name));
                     $this->parser->assign('course', $course);
                     $output->content = $this->parser->parse('frontend/courses/single_course.tpl', array(), TRUE);
                     $output->status = TRUE;
                     $this->_action_success();
                 }
             } else {
                 $output->message = $this->lang->line('courses_message_already_in_course_or_waiting_for_approwal');
                 $this->db->trans_rollback();
             }
         } else {
             $output->message = $this->lang->line('courses_message_subscription_disallowed');
             $this->db->trans_rollback();
         }
     } else {
         $output->message = $this->lang->line('courses_message_course_not_found');
         $this->db->trans_rollback();
     }
     $this->output->set_output(json_encode($output));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:62,代码来源:courses.php

示例11: _saveParticipant

 private function _saveParticipant($participant, $campaign, $vars)
 {
     if (!$participant) {
         $participant = new Participant(array("user_id" => $this->user->id, "campaign_id" => $campaign->id, "live" => true));
     }
     $participant->image = $vars['filename'];
     $participant->save();
     $p = Registry::get("MongoDB")->participants;
     $record = $p->findOne(array('participant_id' => (int) $participant->id, 'campaign_id' => (int) $campaign->id));
     if (!$record) {
         $p->insert(array('participant_id' => (int) $participant->id, 'campaign_id' => (int) $campaign->id, 'title' => $campaign->title, 'description' => $campaign->description, 'image' => $vars['filename'], 'url' => 'game/result/' . $participant->id));
     }
 }
开发者ID:SwiftDeal,项目名称:fbfunapp,代码行数:13,代码来源:play.php

示例12: import_single_line

 public function import_single_line()
 {
     $this->output->set_content_type('application/json');
     $firstname = $this->input->post('firstname');
     $lastname = $this->input->post('lastname');
     $fullname = $this->input->post('fullname');
     $email = $this->input->post('email');
     $options = $this->input->post('options');
     $this->parser->assign('firstname', $firstname);
     $this->parser->assign('lastname', $lastname);
     $this->parser->assign('fullname', $fullname);
     $this->parser->assign('email', $email);
     if ((trim($firstname) != '' && trim($lastname) != '' || trim($fullname) != '') && trim($email) != '') {
         $student_fullname = trim($fullname) != '' ? trim($fullname) : trim($firstname) . ' ' . trim($lastname);
         $this->_transaction_isolation();
         $this->db->trans_begin();
         $student = new Student();
         $student->where('email', trim($email));
         $student->get();
         if ($student->exists()) {
             if ($student->fullname != $student_fullname) {
                 $student->fullname = $student_fullname;
                 $student->save();
                 $this->db->trans_commit();
             } else {
                 $this->db->trans_rollback();
             }
             $this->parser->assign('error_message', 'lang:admin_students_csv_import_error_message_student_exists');
         } else {
             $this->load->library('form_validation');
             if ($this->form_validation->valid_email(trim($email))) {
                 $student->email = trim($email);
                 $student->fullname = $student_fullname;
                 $password = '';
                 if ($options['password_type'] == 'default') {
                     $password = $this->config->item('student_import_default_password');
                 } elseif ($options['password_type'] == 'random') {
                     $password = md5(base64_encode(rand(0, 99999999999) . time() . $student->fullname . $student->email) . $this->config->item('encryption_key'));
                     $password = substr($password, 0, rand(6, 20));
                 }
                 $student->password = $password != '' ? sha1($password) : '';
                 $student->language = $this->config->item('language');
                 if ($student->save()) {
                     $this->parser->assign('password', $password);
                     $this->db->trans_commit();
                     $this->parser->assign('success_message', 'lang:admin_students_csv_import_successfully_imported');
                     if ((bool) $options['send_mail']) {
                         if ($password == '') {
                             $this->_transaction_isolation();
                             $this->db->trans_begin();
                             $student->generate_random_password_token();
                             $this->db->trans_commit();
                         }
                         $this->_init_language_for_student($student);
                         $this->load->library('email');
                         $this->email->from_system();
                         $this->email->to($student->email);
                         $this->email->subject($this->lang->line('admin_students_csv_import_email_subject'));
                         $this->email->build_message_body('file:emails/backend/students/csv_import_email.tpl', array('student' => $student, 'password' => $password));
                         $sent = $this->email->send();
                         $this->_init_language_for_teacher();
                         if ($sent) {
                             $this->parser->assign('email_success_message', 'lang:admin_students_csv_import_email_sent_successfully');
                         } else {
                             $this->parser->assign('email_error_message', 'lang:admin_students_csv_import_email_sent_failed');
                         }
                     }
                 } else {
                     $this->db->trans_rollback();
                     $this->parser->assign('error_message', 'lang:admin_students_csv_import_error_message_student_save_error');
                 }
             } else {
                 $this->db->trans_rollback();
                 $this->parser->assign('error_message', 'lang:admin_students_csv_import_error_message_student_email_invalid');
             }
         }
         if ($student->exists()) {
             $this->parser->assign('student_id', $student->id);
             if (intval($options['assign_to_course']) > 0) {
                 $this->_transaction_isolation();
                 $this->db->trans_begin();
                 $course = new Course();
                 $course->get_by_id(intval($options['assign_to_course']));
                 if ($course->exists()) {
                     $participant = new Participant();
                     $participant->where_related('student', 'id', $student->id);
                     $participant->where_related('course', 'id', $course->id);
                     $participant->get();
                     if (!$participant->exists()) {
                         $participant->allowed = 0;
                         if ($participant->save(array('student' => $student, 'course' => $course))) {
                             $this->db->trans_commit();
                             $this->parser->assign('course_assignment_success_message', 'lang:admin_students_csv_import_successfully_added_course_participation');
                             $this->db->trans_begin();
                             $course = new Course();
                             $course->get_by_id(intval($options['assign_to_course']));
                             $participant->allowed = 1;
                             $participant->save();
                             $participants = new Participant();
                             $participants->where_related($course);
//.........这里部分代码省略.........
开发者ID:andrejjursa,项目名称:list-lms,代码行数:101,代码来源:students.php

示例13: PaymentStore

 public function PaymentStore($club, $id)
 {
     $uuid = Uuid::generate();
     $uuid2 = Uuid::generate();
     $user = Auth::user();
     $club = Club::find($club);
     $event = Evento::find($id);
     $cart = Cart::contents(true);
     //Addition for stub feature
     $follow = Follower::where("user_id", "=", $user->id)->FirstOrFail();
     //check if follower equal club
     if ($follow->club_id != $club->id) {
         $param = array('ccnumber' => str_replace('_', '', Input::get('card')), 'ccexp' => sprintf('%02s', Input::get('month')) . Input::get('year'), 'cvv' => Input::get('cvv'), 'address1' => Input::get('address'), 'city' => Input::get('city'), 'state' => Input::get('state'), 'zip' => Input::get('zip'), 'discount' => Input::get('discount'), 'club' => $club->id, 'firstname' => $user->profile->firstname, 'lastname' => $user->profile->lastname, 'phone' => $user->profile->mobile);
     } else {
         $param = array('customer_vault_id' => $user->profile->customer_vault, 'discount' => Input::get('discount'), 'club' => $club->id);
     }
     $payment = new Payment();
     $transaction = $payment->sale($param);
     if ($transaction->response == 3 || $transaction->response == 2) {
         return Redirect::action('ClubPublicController@PaymentCreate', array($club->id, $event->id))->with('error', $transaction->responsetext);
     } else {
         foreach (Cart::contents() as $item) {
             $player = Player::find($item->player_id);
             $payment->id = $uuid;
             $payment->customer = $user->profile->customer_vault;
             $payment->transaction = $transaction->transactionid;
             $payment->subtotal = $transaction->subtotal;
             $payment->service_fee = $transaction->fee;
             $payment->total = $transaction->total;
             $payment->promo = $transaction->promo;
             $payment->tax = $transaction->tax;
             $payment->discount = $transaction->discount;
             $payment->club_id = $club->id;
             $payment->user_id = $user->id;
             $payment->player_id = $player->id;
             $payment->event_type = $event->type_id;
             $payment->type = $transaction->type;
             $payment->save();
             $participant = new Participant();
             $participant->id = $uuid2;
             $participant->firstname = $player->firstname;
             $participant->lastname = $player->lastname;
             $participant->due = $event->getOriginal('fee');
             $participant->early_due = $event->getOriginal('early_fee');
             $participant->early_due_deadline = $event->early_deadline;
             $participant->event_id = $item->event_id;
             $participant->player_id = $player->id;
             $participant->accepted_on = Carbon::Now();
             $participant->accepted_by = $user->profile->firstname . ' ' . $user->profile->lastname;
             $participant->accepted_user = $user->id;
             $participant->status = 1;
             $participant->method = 'full';
             $participant->save();
             $salesfee = $item->price / getenv("SV_FEE") - $item->price;
             $sale = new Item();
             $sale->description = $item->name;
             $sale->quantity = $item->quantity;
             $sale->price = $item->price;
             $sale->fee = $salesfee;
             $sale->payment_id = $uuid;
             $sale->event_id = $item->event_id;
             $sale->participant_id = $uuid2;
             $sale->save();
             if ($event->max < $event->participants->count()) {
                 //add to waitlist
                 $waitlist = new Waitlist();
                 $waitlist->id = Uuid::generate();
                 $waitlist->participant_id = $uuid2;
                 $waitlist->event_id = $event->id;
                 $waitlist->save();
                 return $waitlist;
             }
         }
         //email receipt
         $payment->receipt($transaction, $club->id, $item->player_id);
         return Redirect::action('ClubPublicController@PaymentSuccess', array($club->id, $event->id))->with('result', $transaction);
     }
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:78,代码来源:ClubPublicController.php


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