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


PHP Carbon::Now方法代码示例

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


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

示例1: PaymentStore

 public function PaymentStore($id)
 {
     $user = Auth::user();
     $participant = Participant::find($id);
     $title = 'League Together - ' . $participant->event->club->name . ' Teams';
     $player = $participant->player;
     $club = $participant->event->club;
     $cart = Cart::contents(true);
     $uuid = Uuid::generate();
     //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('ParticipantController@paymentCreate', array($participant->id))->with('error', $transaction->responsetext);
     } else {
         foreach (Cart::contents() as $item) {
             $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 = $item->player_id;
             $payment->event_type = $participant->event->type_id;
             $payment->type = $transaction->type;
             $payment->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->participant_id = $participant->id;
             $sale->payment_id = $uuid;
             $sale->event_id = $participant->event->id;
             $sale->save();
             $participant->accepted_on = Carbon::Now();
             $participant->accepted_by = $user->profile->firstname . ' ' . $user->profile->lastname;
             $participant->accepted_user = $user->id;
             $participant->method = $item->type;
             $participant->status = 1;
             $participant->save();
             //create payments plan schedule
             if ($item->type == "plan") {
                 $subtotal = $participant->plan->getOriginal('recurring');
                 $fee = $subtotal / getenv("SV_FEE") - $subtotal;
                 $total = $fee + $subtotal;
                 for ($x = 1; $x < $participant->plan->recurrences + 1; $x++) {
                     $today = Carbon::now();
                     $today->addMonths($x);
                     $payon = $participant->plan->getOriginal('on');
                     //make sure the payday is a valid day
                     if ($payon == 31) {
                         if ($today->month == 2) {
                             $payon = 28;
                         }
                         if ($today->month == 4 || $today->month == 6 || $today->month == 9 || $today->month == 11) {
                             $payon = 30;
                         }
                     }
                     $payday = Carbon::create($today->year, $today->month, $payon, 0);
                     $schedule = new SchedulePayment();
                     $schedule->date = $payday;
                     $schedule->description = "Membership Team " . $participant->event->name;
                     $schedule->subtotal = number_format($subtotal, 2);
                     $schedule->fee = number_format($fee, 2);
                     $schedule->total = number_format($total, 2);
                     $schedule->plan_id = $participant->plan->id;
                     $schedule->club_id = $club->id;
                     $schedule->participant_id = $participant->id;
                     $status = $schedule->save();
                     if (!$status) {
                         return "We process your payment but and error occurred in the process, please contact us: support@leaguetogether.com Error# 597";
                     }
                 }
                 //end for loop
             }
             //end if plan
         }
         //email receipt
         $payment->receipt($transaction, $club->id, $item->player_id);
         $data = array('club' => $club, 'player' => $player, 'user' => $user, 'participant' => $participant);
         $mail = Mail::send('emails.notification.event.accept', $data, function ($message) use($user, $club, $participant) {
             $message->from('C2C@leaguetogether.com', 'C2C Lacrosse')->to($user->email, $participant->accepted_by)->subject("Thank you for joining our event | " . $club->name);
             foreach ($club->users()->get() as $value) {
                 $message->bcc($value->email, $club->name);
             }
         });
//.........这里部分代码省略.........
开发者ID:illuminate3,项目名称:league-production,代码行数:101,代码来源:ParticipantController.php

示例2: PaymentStoreTeam

 public function PaymentStoreTeam($club, $id)
 {
     $user = Auth::user();
     $team = Team::find($id);
     $club = Club::find($club);
     $cart = Cart::contents(true);
     $uuid = Uuid::generate();
     $uuidMember = Uuid::generate();
     //Addition for stub feature
     $follow = Follower::where("user_id", "=", $user->id)->FirstOrFail();
     $title = 'League Together - ' . $team->club->name . ' Teams';
     //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@PaymentCreateTeam', array($club->id, $team->id))->with('error', $transaction->responsetext);
     } else {
         foreach (Cart::contents() as $item) {
             $player = Player::find($item->player_id);
             //default from team
             $due = $team->getOriginal('due');
             $early_due = $team->getOriginal('early_due');
             $early_due_deadline = $team->getOriginal('early_due_deadline');
             $member = new Member();
             $member->id = $uuidMember;
             $member->firstname = $player->firstname;
             $member->lastname = $player->lastname;
             $member->due = $due;
             $member->early_due = $early_due;
             $member->early_due_deadline = $early_due_deadline;
             $member->plan_id = $team->plan_id;
             $member->player_id = $player->id;
             $member->team_id = $item->team_id;
             $member->accepted_on = Carbon::Now();
             $member->accepted_by = $user->profile->firstname . ' ' . $user->profile->lastname;
             $member->accepted_user = $user->id;
             $member->method = $item->type;
             $member->status = 1;
             $member->save();
             $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 = $item->player_id;
             $payment->event_type = null;
             $payment->type = $transaction->type;
             $payment->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->member_id = $uuidMember;
             $sale->team_id = $item->team_id;
             $sale->payment_id = $uuid;
             $sale->save();
             $member = Member::find($uuidMember);
             //create payments plan schedule
             if ($item->type == "plan") {
                 $subtotal = $member->plan->getOriginal('recurring');
                 $fee = $subtotal / getenv("SV_FEE") - $subtotal;
                 $total = $fee + $subtotal;
                 for ($x = 1; $x < $member->plan->recurrences + 1; $x++) {
                     $today = Carbon::now();
                     $today->addMonths($x);
                     $payon = $member->plan->getOriginal('on');
                     //make sure the payday is a valid day
                     if ($payon == 31) {
                         if ($today->month == 2) {
                             $payon = 28;
                         }
                         if ($today->month == 4 || $today->month == 6 || $today->month == 9 || $today->month == 11) {
                             $payon = 30;
                         }
                     }
                     $payday = Carbon::create($today->year, $today->month, $payon, 0);
                     $schedule = new SchedulePayment();
                     $schedule->date = $payday;
                     $schedule->description = "Membership Team " . $member->team->name;
                     $schedule->subtotal = number_format($subtotal, 2);
                     $schedule->fee = number_format($fee, 2);
                     $schedule->total = number_format($total, 2);
                     $schedule->plan_id = $member->plan->id;
                     $schedule->club_id = $club->id;
                     $schedule->member_id = $member->id;
                     $status = $schedule->save();
                     if (!$status) {
//.........这里部分代码省略.........
开发者ID:illuminate3,项目名称:league-production,代码行数:101,代码来源:ClubPublicController.php


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