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


PHP Transaction::where方法代码示例

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


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

示例1: postGenerateLicense

 /**
  * Generate license
  */
 public function postGenerateLicense()
 {
     $rules = array('transaction_id' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('admin/utilities/generate-license')->withErrors($validator)->withInput();
     } else {
         $transaction_id = Input::get('transaction_id');
         if ($transaction = Transaction::where('id', '=', $transaction_id)->first()) {
             if ($license = License::where('transaction_id', '=', $transaction_id)->first()) {
                 Session::flash('alert_error', '<strong>Ooops!</strong> License for given transaction already exists.');
                 return Redirect::to('admin/licenses?q=' . $license->license_key . '&param=key');
             }
             $plan = Plan::where('id', '=', $transaction->plan_id)->first();
             if ($plan->has_license) {
                 $product = Product::where('id', '=', $plan->product_id)->first();
                 $license_key = License::generate($product->code);
                 // Save license
                 $license = new License();
                 $license->license_key = $license_key;
                 $license->transaction_id = $transaction_id;
                 $license->allowed_usage = $plan->license_allowed_usage;
                 $license->save();
                 Session::flash('alert_message', '<strong>Well done!</strong> You successfully have generated license key.');
                 return Redirect::to('admin/licenses?q=' . $license_key . '&param=key');
             } else {
                 Session::flash('alert_error', '<strong>Ooops!</strong> This plan does not allow to generate a license key.');
                 return Redirect::to('admin/utilities/generate-license');
             }
         } else {
             Session::flash('alert_error', '<strong>Ooops!</strong> Transaction was not found.');
             return Redirect::to('admin/utilities/generate-license');
         }
     }
 }
开发者ID:michaelotto126,项目名称:dksolution,代码行数:38,代码来源:UtilitiesController.php

示例2: update

 /**
  * Update the specified resource in storage.
  * PUT /transactions/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $transactions = Transaction::where('id', $id)->update(Input::all());
     if ($transactions) {
         return ['status' => true, 'data' => $transactions];
     } else {
         return ['status' => false];
     }
 }
开发者ID:anildukkipatty,项目名称:fu,代码行数:16,代码来源:TransactionsController.php

示例3: reservation

 public function reservation($id)
 {
     $reservation = Reservation::findOrFail($id);
     if ($this->user->id == $reservation->user_id) {
         $transaction = Transaction::where('reservation_id', $reservation->id)->first();
         $pdf = storage_path() . '/reservations/reservation-' . $transaction->reference_number . '.pdf';
         if (file_exists($pdf)) {
             return Response::download($pdf);
         } else {
             return Redirect::to('clients')->with('error', 'PDF was not found.');
         }
     } else {
         return App::abort(404);
     }
 }
开发者ID:jacobDaeHyung,项目名称:Laravel-Real-Estate-Manager,代码行数:15,代码来源:PublicClientsController.php

示例4: function

    }
    $view->with('data', $data)->with('moneyAvailable', $userMoneyAvailable)->with('lastInvest', $lastInvest);
});
View::creator('backend.user.withdraw', function ($view) {
    $uid = Auth::user()->id;
    $user = User::where('id', '=', $uid)->first();
    $totalAdded = $user->userMoney->ammount_added;
    $totalInvested = $user->userMoney->ammount_invested;
    $totalRewarded = $user->userMoney->ammount_won;
    $totalWithdrawn = $user->userMoney->ammount_withdrawn;
    $userMoneyAvailable = $totalAdded + $totalRewarded - ($totalInvested + $totalWithdrawn);
    $view->with('moneyAvailable', $userMoneyAvailable);
});
View::creator('includes.backend.cycles', function ($view) {
    $uid = Auth::user()->id;
    $lastInvest = Transaction::where('user_id', '=', $uid)->where('transaction_direction', '=', 'invested')->orderBy('id', 'DESC')->first();
    $amount = 0;
    if ($lastInvest) {
        $amount = $lastInvest->ammount;
    }
    $view->with('lastInvestedAmmount', $amount);
});
View::creator('homepage', function ($view) {
    $blocks = Block::all();
    // TODO: Improve this part. Add validation.
    foreach ($blocks as $block) {
        $block->content = json_decode($block->content);
    }
    $view->with('blocks', $blocks);
});
App::missing(function ($exception) {
开发者ID:fencer-md,项目名称:stoticlle,代码行数:31,代码来源:routes.php

示例5: relatorios

 public function relatorios()
 {
     $data = Input::all();
     if (!isset($data['view'])) {
         $data['view'] = 'month';
     }
     if (!isset($data['date_from'])) {
         $data['date_from'] = date('Y-m-d');
     }
     // NAVIGATION
     if (!isset($data['next'])) {
         $data['next'] = 0;
     }
     if (!isset($data['prev'])) {
         $data['prev'] = 0;
     }
     if (@$data['next'] == @$data['prev']) {
         $data['next'] = $data['prev'] = 0;
     }
     // echo "<pre>";
     // print_r($data);
     // echo "</pre>";
     // exit;
     //MESSAGES
     $info = array();
     /*
     	FILTROS DE EXIBIÇÃO
     */
     switch ($data['view']) {
         case 'day':
             $view = "transactions.views.day";
             $date = Carbon::createFromFormat('Y-m-d', $data['date_from'])->addDays($data['next'])->subDays($data['prev']);
             $transactions = Transaction::where('date', $date->format('Y-m-d'))->where('user_id', Auth::id())->orderBy('date')->get();
             if ($date->isToday()) {
                 $title = "hoje";
                 $labels['end'] = 'fim do dia';
             } else {
                 if ($date->isTomorrow()) {
                     $title = "amanhã";
                     $labels['end'] = 'depois de amanhã';
                 } else {
                     if ($date->isYesterday()) {
                         $title = "ontem";
                         $labels['end'] = 'hoje';
                     } else {
                         $title = strftime("%d de %B", strtotime($date));
                         $labels['end'] = strftime("%A, %d de %B", strtotime($date->addDay()));
                     }
                 }
             }
             break;
         case 'week':
             $view = "transactions.views.week";
             $date = Carbon::createFromFormat('Y-m-d', $data['date_from'])->addWeeks($data['next'])->subWeeks($data['prev']);
             $transactions = Transaction::where('date', '>=', $date->startOfWeek()->format('Y-m-d'))->where('date', '<=', $date->endOfWeek()->format('Y-m-d'))->where('user_id', Auth::id())->orderBy('date')->get();
             $title = strftime("%a %d/%m", strtotime($date->startOfWeek())) . " à " . strftime("%a %d/%m", strtotime($date->endOfWeek()));
             $labels['end'] = strftime("%A, %d de %B", strtotime($date->endOfWeek()->addDay()));
             break;
         case 'range':
             $view = "transactions.views.index";
             $transactions = Transaction::where('date', '>=', $data['date_from'])->where('date', '<=', $data['date_to'])->where('user_id', Auth::id())->orderBy('date')->get();
             $date = Carbon::createFromFormat('Y-m-d', @$data['date_to']);
             $title = strftime("%d de %B", strtotime($data['date_from'])) . " à " . strftime("%d de %B", strtotime(@$data['date_to']));
             $labels['end'] = strftime("%A, %d de %B", strtotime($date));
             break;
         case 'overdue':
             $view = "transactions.views.overdue";
             $date = Carbon::now();
             $transactions = Transaction::where('done', 0)->where('date', '<', $date->format('Y-m-d'))->orderBy('date')->where('user_id', Auth::id())->get();
             if (count($transactions) <= 0) {
                 $info[] = ['class' => 'alert-success', 'message' => "Nenhum lançamento pendente. Muito bem!"];
             } else {
                 $info[] = ['class' => 'alert-warning', 'message' => '<strong><i class="fa fa-warning"></i></strong> Você tem <strong>' . count($transactions) . '</strong> lançamentos pendentes.'];
             }
             $title = "pendentes";
             $labels['end'] = strftime("%d de %B", strtotime($date));
             break;
         default:
             // case 'month':
             $view = "transactions.views.month";
             $date = Carbon::createFromFormat('Y-m-d', $data['date_from'])->addMonths($data['next'])->subMonths($data['prev']);
             $transactions = Transaction::where('date', '>=', $date->startOfMonth()->format('Y-m-d'))->where('date', '<=', $date->endOfMonth()->format('Y-m-d'))->where('user_id', Auth::id())->orderBy('date', 'DESC')->get();
             $title = strftime("%B de %Y", strtotime($date));
             $labels['end'] = "fim de " . strftime("%B", strtotime($date));
             break;
     }
     // STATUS NO PERÍODO
     $receitas = $transactions->filter(function ($transaction) {
         if ($transaction->type == 'receita') {
             return $transaction;
         }
     });
     $receitas_ok = $receitas->filter(function ($transaction) {
         if ($transaction->done == '1') {
             return $transaction;
         }
     });
     $despesas = $transactions->filter(function ($transaction) {
         if ($transaction->type == 'despesa') {
             return $transaction;
//.........这里部分代码省略.........
开发者ID:waldenylson,项目名称:alfredapp,代码行数:101,代码来源:TransactionsController.php

示例6: count

					<a href="{{url('tarefas')}}" class="btn btn-link tarefas-info">                        
						<i class="fa fa-check-square-o fa-2x"></i>
						
						<?php 
    $tarefas_info = count(Tarefa::where('done', 0)->where('date', '<=', date('Y-m-d'))->get());
    ?>
						@if ($tarefas_info)
						<span class="badge badge-danger">{{ $tarefas_info }}</span>
						@endif
					</a>

					<a  href="{{url('financeiro')}}" class="btn btn-link transactions_info">

						<i class="icon-dollar fa-2x"></i>
						<?php 
    $transactions_info = count(Transaction::where('done', 0)->where('date', '<=', date('Y-m-d'))->where('user_id', Auth::id())->get());
    ?>
						@if ($transactions_info)
						<span class="badge badge-danger">{{ $transactions_info }}</span>
						@endif
					</a>

					
				</div>
				
			</div>

			

			<a id="logo" class="pull-right hidden-xs"  href="<?php 
    echo url('/');
开发者ID:waldenylson,项目名称:alfredapp,代码行数:31,代码来源:master.blade.php

示例7: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $transaction = Transaction::where('id', '=', $id)->first();
     $transaction->delete();
     return Response::json(array('message' => 'transaction deleted'), 200);
 }
开发者ID:yeyande,项目名称:CS499,代码行数:12,代码来源:TransactionController.php

示例8: postOpensession

 public function postOpensession()
 {
     $outlet = Input::get('outlet_id');
     $open_session = Transaction::where('outletId', $outlet)->where('sessionStatus', 'open')->distinct('sessionId')->get()->toArray();
     $open_sessions = array();
     foreach ($open_session as $op) {
         $open_sessions[] = $op[0];
     }
     $result = array('opensession' => $open_sessions, 'result' => 'OK');
     return Response::json($result);
 }
开发者ID:awidarto,项目名称:tmadminflat,代码行数:11,代码来源:PosController.php

示例9: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $users = User::all();
     foreach ($users as $user) {
         $dateInvested = new DateTime($user->invested_date);
         $days = Config::get('rate.days');
         $dateInvested->modify('+' . $days . ' days');
         $formattedDate = $dateInvested->format('Y-m-d H:i:s');
         $currentDate = date('Y-m-d H:i:s');
         if ($formattedDate <= $currentDate) {
             $transactions = Transaction::where('user_id', '=', $user->id)->where('transaction_direction', '=', 'invested')->get();
             $transactionsCount = count($transactions);
             if (count($transactions) == 0) {
                 $ammount = 0;
             } else {
                 $ammount = $transactions[$transactionsCount - 1]->ammount;
             }
             if ($user->investor == 0 || $user->investor == 1 && $ammount < 1000) {
                 $lastInvest = Transaction::where('user_id', '=', $user->id)->where('transaction_direction', '=', 'invested')->orderBy('id', 'DESC')->first();
                 $reward = new Transaction();
                 $reward->ammount = Helper::reward($ammount, $user->cycle_duration, $user->investment_rate);
                 $reward->transaction_direction = 'reward';
                 $reward->user_id = $user->id;
                 $reward->confirmed = 1;
                 $reward->date = date('Y-m-d H:i:s');
                 $reward->save();
                 $user->investor = 1;
                 $user->awarded = 1;
                 $user->awaiting_award = 0;
                 $user->invested_date = NULL;
                 $user->cycle_duration = NULL;
                 $user->investment_rate = 0;
                 $user->save();
                 $user->userMoney->current_available += $reward->ammount + $lastInvest->ammount;
                 $user->userMoney->times_won++;
                 $user->userMoney->ammount_won += $reward->ammount;
                 $user->userMoney->save();
             } elseif ($user->investor == 1) {
                 $offer = Offer::where('recipient_id', '=', $user->id)->orderBy('id', 'DESC')->first();
                 if ($offer != null) {
                     $rate = $offer->daily_rate;
                 } else {
                     $rate = $user->investment_rate;
                 }
                 $lastInvest = Transaction::where('user_id', '=', $user->id)->where('transaction_direction', '=', 'invested')->orderBy('id', 'DESC')->first();
                 $reward = new Transaction();
                 $reward->ammount = Helper::reward($ammount, $user->cycle_duration, $rate);
                 $reward->transaction_direction = 'reward';
                 $reward->user_id = $user->id;
                 $reward->confirmed = 1;
                 $reward->date = date('Y-m-d H:i:s');
                 $reward->save();
                 $user->awarded = 1;
                 $user->awaiting_award = 0;
                 $user->invested_date = NULL;
                 $user->cycle_duration = NULL;
                 $user->investment_rate = 0;
                 $user->save();
                 $user->userMoney->current_available += $reward->ammount + $lastInvest->ammount;
                 $user->userMoney->times_won++;
                 $user->userMoney->ammount_won += $reward->ammount;
                 $user->userMoney->save();
             }
         }
     }
 }
开发者ID:fencer-md,项目名称:stoticlle,代码行数:71,代码来源:RewardUsers.php

示例10: getUnactionedLoanCount

 private function getUnactionedLoanCount()
 {
     $newLoans = Loan::where('status_id', 1)->get()->toArray();
     foreach ($newLoans as $index => $loan) {
         $transactions = Transaction::where('loan_id', $loan['id'])->where('user_id', '!=', $loan['user_id'])->get()->toArray();
         if (isset($transactions[0])) {
             // Remove this loan
             unset($newLoans[$index]);
         }
     }
     return array('unactionedLoanCount' => count($newLoans));
 }
开发者ID:julianfresco,项目名称:documentHub,代码行数:12,代码来源:LoanController.php

示例11: saveFee

 private function saveFee($new_transaction)
 {
     $tx_hash = $new_transaction->tx_id;
     /* get for that transaction a miners fee, at this point we know it already */
     Queue::push(function ($job) use($tx_hash) {
         // get_transaction from bitcoin core
         $tx_info = $this->bitcoin_core->gettransaction($tx_hash);
         $fee = isset($tx_info['fee']) ? abs(bcmul($tx_info['fee'], SATOSHIS_FRACTION)) : null;
         // save fee for that transaction hash
         Transaction::where('tx_id', $tx_hash)->update(['network_fee' => $fee]);
         $job->delete();
     });
 }
开发者ID:s1rxploit,项目名称:EzBitcoin-Api-Wallet,代码行数:13,代码来源:ApiController.php

示例12: postFindTransaction

 /**
  * Find Transaction
  *
  * Find a transaction by email and plan code
  */
 public function postFindTransaction()
 {
     if ($this->_isValidRequest()) {
         $plan = Input::get('plan');
         $email = Input::get('email');
         if (!$plan) {
             $this->_invalidRequest("Plan parameter is required");
         }
         if (!$email) {
             $this->_invalidRequest("Email parameter is required");
         }
         // Get Plan
         $plan = Plan::where('code', '=', $plan)->first();
         if (!$plan) {
             $this->_invalidRequest("Plan was not found, contact support.");
         }
         // Get buyer
         $buyer = Buyer::where('email', '=', $email)->first();
         if (!$buyer) {
             $this->_invalidRequest("Buyer was not found, contact support.");
         }
         $purchase = Purchase::where('product_id', '=', $plan->product_id)->where('buyer_id', '=', $buyer->id)->first();
         if (!$purchase) {
             $this->_invalidRequest("Purchase was not found, contact support.");
         }
         $transaction = Transaction::where('purchase_id', '=', $purchase->id)->where('plan_id', '=', $plan->id)->first();
         if (!$transaction) {
             $this->_invalidRequest("Transaction was not found, contact support.");
         }
         $transaction = array('id' => $transaction->id, 'amount' => $transaction->amount, 'pay_id' => $transaction->pay_id, 'is_refunded' => $transaction->is_refunded, 'commission_refunded' => $transaction->commission_refunded, 'invoice_id' => $transaction->invoice_id, 'buyer' => array('first_name' => $buyer->first_name, 'last_name' => $buyer->last_name));
         die(json_encode(array('data' => $transaction)));
     }
 }
开发者ID:michaelotto126,项目名称:dksolution,代码行数:38,代码来源:ApiController.php

示例13: usersListNext

 public function usersListNext()
 {
     $sortby = Input::get('sortby');
     $order = Input::get('order');
     $controller = 'usersListNext';
     if ($sortby && $order) {
         $users = User::where('users.investor', '=', 1)->where('users.role', '=', 2)->where('users.investor', '=', 1)->where('users.awaiting_award', '=', 0)->join('user_money_info', 'users.id', '=', 'user_money_info.id')->orderBy($sortby, $order)->get();
     } else {
         $users = User::where('users.investor', '=', 1)->where('users.role', '=', 2)->where('users.investor', '=', 1)->where('users.awaiting_award', '=', 0)->join('user_money_info', 'users.id', '=', 'user_money_info.id')->get();
     }
     foreach ($users as $key => $user) {
         $lastTransaction = Transaction::where('user_id', '=', $user->id)->where('ammount', '>=', '1000')->where('confirmed', '=', 0)->where('transaction_direction', '=', 'invested')->first();
         $lastOffer = count($user->userOffer);
         if ($lastOffer == 0) {
             $lastOffer = null;
         } else {
             $lastOffer = $user->userOffer[$lastOffer - 1]->offer_ends;
         }
         $currentDate = date('Y-m-d H:i:s');
         if ($lastTransaction == null && ($lastOffer == null || $currentDate < $lastOffer)) {
             unset($users[$key]);
         }
         if ($lastOffer != null && $currentDate < $lastOffer) {
             unset($users[$key]);
         }
     }
     return View::make('backend.admin.userslist', ['users' => $users, 'controller' => $controller, 'sortby' => $sortby, 'order' => $order]);
 }
开发者ID:fencer-md,项目名称:stoticlle,代码行数:28,代码来源:UserController.php

示例14: _check_already_purchase

 /**
  * Check if user has already purchase the plan
  */
 private function _check_already_purchase($buyer_email, $product, $plan)
 {
     // Get Buyer
     $buyer = Buyer::where('email', '=', $buyer_email)->first();
     if ($buyer) {
         $purchase = Purchase::where('buyer_id', '=', $buyer->id)->first();
         if ($purchase) {
             if ($transaction = Transaction::where('purchase_id', '=', $purchase->id)->where('plan_id', '=', $plan->id)->where('is_refunded', '=', 0)->first()) {
                 // Redirect to next page
                 header("location: " . $plan->next_page_url);
                 exit;
             }
         }
     }
 }
开发者ID:michaelotto126,项目名称:dksolution,代码行数:18,代码来源:CheckoutController.php

示例15: investMoney

 public function investMoney()
 {
     $uid = Auth::user()->id;
     // Check for custom offer.
     $lastTransaction = Transaction::where('user_id', '=', $uid)->where('transaction_direction', '=', 'invested')->where('ammount', '>=', '1000')->orderBy('created_at', 'DESC')->first();
     // Approve offer.
     if ($lastTransaction != null && $lastTransaction->confirmed == 0) {
         $lastTransaction->confirmed = 1;
         $lastTransaction->date = date('Y-m-d H:i:s');
         $user = User::where('id', '=', $uid)->first();
         $user->awaiting_award = 1;
         $user->invested_date = date('Y-m-d H:i:s');
         $user->cycle_duration = Config::get('rate.days');
         $user->investment_rate = Config::get('rate.rate');
         $user->userMoney->ammount_invested += $lastTransaction->ammount;
         $user->userMoney->current_available -= $lastTransaction->ammount;
         $user->userMoney->times_invested++;
         $user->userMoney->save();
         $user->save();
         $lastTransaction->user_id = $uid;
         $lastTransaction->save();
         $user = Auth::user();
         $data = MailHelper::prepareData($user);
         $data += ['ammount' => $lastTransaction->ammount];
         Mail::send('emails.invested', $data, function ($message) use($user) {
             $message->to($user->email)->subject('Successful transfer!');
         });
         return Redirect::back();
     } elseif (Input::get('ammount') > Input::get('moneyAvailable')) {
         return Redirect::to('user/addmoney')->with('msg', "You don't have enough money to invest.");
     } else {
         // Input validation.
         $rules = ['ammount' => ['required', 'numeric', 'min:' . Config::get('rate.min')]];
         $validator = Validator::make(Input::all(), $rules);
         if ($validator->fails()) {
             return Redirect::back()->withErrors($validator);
         }
         $transaction = new Transaction();
         $transaction->ammount = Input::get('ammount');
         $transaction->transaction_direction = 'invested';
         if (Auth::user()->investor == 1 && Input::get('ammount') < 1000) {
             $user = User::where('id', '=', $uid)->first();
             $transaction->confirmed = 1;
             $user->userMoney->ammount_invested += Input::get('ammount');
             $user->userMoney->current_available -= Input::get('ammount');
             $user->userMoney->times_invested++;
             $user->userMoney->save();
             $transaction->date = date('Y-m-d H:i:s');
             $user = User::where('id', '=', $uid)->first();
             $user->awaiting_award = 1;
             $user->invested_date = date('Y-m-d H:i:s');
             $user->cycle_duration = Config::get('rate.days');
             $user->investment_rate = Config::get('rate.rate');
             $user->save();
         } elseif (Auth::user()->investor == 1) {
             $transaction->confirmed = 0;
         } else {
             $user = User::where('id', '=', $uid)->first();
             $transaction->confirmed = 1;
             $user->userMoney->ammount_invested += Input::get('ammount');
             $user->userMoney->current_available -= Input::get('ammount');
             $user->userMoney->times_invested++;
             $user->userMoney->save();
             $transaction->date = date('Y-m-d H:i:s');
             $user = User::where('id', '=', $uid)->first();
             $user->awaiting_award = 1;
             $user->invested_date = date('Y-m-d H:i:s');
             $user->cycle_duration = Config::get('rate.days');
             $user->investment_rate = Config::get('rate.rate');
             $user->save();
         }
         $transaction->user_id = $uid;
         $transaction->save();
         $user = Auth::user();
         $data = MailHelper::prepareData($user);
         $data += ['ammount' => $transaction->ammount, 'invested' => 'pending'];
         Mail::send('emails.invested', $data, function ($message) use($user) {
             $message->to($user->email)->subject('Successful transfer!');
         });
         return Redirect::back();
     }
 }
开发者ID:fencer-md,项目名称:stoticlle,代码行数:82,代码来源:TransactionsController.php


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