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


PHP Account::findOrFail方法代码示例

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


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

示例1: update

 /**
  * Update the specified account in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $account = Account::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Account::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $account->update($data);
     return Redirect::route('accounts.index');
 }
开发者ID:RedTechs,项目名称:sfproject,代码行数:16,代码来源:AccountsController.php

示例2: debitAccount

 public function debitAccount($data, $trans_no)
 {
     $journal = new Journal();
     $account = Account::findOrFail($data['debit_account']);
     $journal->account()->associate($account);
     $journal->date = $data['date'];
     $journal->trans_no = $trans_no;
     $journal->initiated_by = $data['initiated_by'];
     $journal->amount = $data['amount'];
     $journal->type = 'debit';
     $journal->description = $data['description'];
     $journal->save();
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:13,代码来源:Journal.php

示例3: update

 /**
  * Update the specified journal in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $journal = Journal::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Journal::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $branch = Branch::findOrFail(Input::get('branch_id'));
     $account = Account::findOrFail(Input::get('account_id'));
     $journal->branch()->associate($branch);
     $journal->account()->associate($account);
     $journal->date = Input::get('date');
     $journal->trans_no = Input::get('trans_no');
     $journal->initiated_by = Input::get('initiated_by');
     $journal->amount = Input::get('amount');
     $journal->type = Input::get('type');
     $journal->description = Input::get('description');
     $journal->update();
     return Redirect::route('journals.index');
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:26,代码来源:JournalsController.php

示例4: newNotaEntrega

 public function newNotaEntrega()
 {
     $client = null;
     $account = Account::findOrFail(Auth::user()->account_id);
     // if ($clientPublicId)
     // {
     // 	$client = Client::scope($clientPublicId)->first();
     //  		}
     $branch = Branch::where('id', '=', Session::get('branch_id'))->first();
     $today = date("Y-m-d");
     $expire = $branch->deadline;
     $today_time = strtotime($today);
     $expire_time = strtotime($expire);
     if ($expire_time < $today_time) {
         Session::flash('error', 'La fecha límite de emisión caducó, porfavor actualice su Dosificación');
         return Redirect::to('sucursales/' . $branch->public_id . '/edit');
     }
     $last_invoice = Invoice::where('account_id', Auth::user()->account_id)->where('branch_id', Session::get('branch_id'))->max('invoice_date');
     $last_date = strtotime($last_invoice);
     $secs = $today_time - $last_date;
     // == <seconds between the two times>
     $days = $secs / 86400;
     $invoiceDesigns = TypeDocument::where('account_id', \Auth::user()->account_id)->orderBy('public_id', 'desc')->get();
     $data = array('entityType' => ENTITY_INVOICE, 'account' => $account, 'invoice' => null, 'showBreadcrumbs' => false, 'data' => Input::old('data'), 'invoiceDesigns' => $invoiceDesigns, 'method' => 'POST', 'url' => 'factura', 'title' => trans('texts.new_invoice'), 'vencido' => 0, 'last_invoice_date' => $days);
     $data = array_merge($data, self::getViewModel());
     return View::make('factura.newNotaEntrega', $data);
 }
开发者ID:Vrian7ipx,项目名称:repocas,代码行数:27,代码来源:invoiceController.php

示例5: destroy

 /**
  * Remove the specified account from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $account = Account::findOrFail($id);
     Account::destroy($id);
     Audit::logaudit('Accounts', 'delete', 'deleted:' . $account->name . ' ' . $account->code);
     return Redirect::route('accounts.index');
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:13,代码来源:AccountsController.php

示例6: handleBankStatement

 public function handleBankStatement()
 {
     $account = Account::findOrFail(Input::get('account'));
     if (Input::get('bank_statement') == 1) {
         $account->bank_statement = Input::get('bank_statement');
         // store bank statement;
         $account->save();
         //update information to Valid table
         $member_id = $account->membership_id;
         //submit money to date
         $toDate = $account->to;
         //return $date;
         //converting date to srting
         $date = AppHelper::dateToString($toDate);
         //validateion upto date
         $upToDate = AppHelper::addThreeYear($toDate);
         //converting date to srting
         $upToDate = AppHelper::dateToString($upToDate);
         $currentDate = AppHelper::currentDate();
         //update valid database
         DB::update('update valids set valid=1,toDate =' . $date . ',upToDate=' . $upToDate . ' where membership_id=' . $member_id);
         if ($currentDate < $upToDate) {
             DB::update('update members set status=1 where membership_id=' . $member_id);
         }
         return Redirect::action('AdminAccountController@index')->with('flash_edit_success', 'Congratulation,You have submitted a bank statement');
     } else {
         return Redirect::action('AdminAccountController@index')->with('flash_dlt_success', 'Sorry, You do not submitted any bank statement.');
     }
 }
开发者ID:BDMADE,项目名称:DBA,代码行数:29,代码来源:AdminAccountController.php

示例7: recordpayment

 public function recordpayment($id)
 {
     $order = Order::findOrFail($id);
     $order->amount_paid = Input::get('amount_paid');
     $order->update();
     $account = Account::findOrFail(Input::get('payment_method'));
     $amount = $account->balance + Input::get('amount_paid');
     $account->balance = $amount;
     $account->update();
     return Redirect::route('orders.index');
 }
开发者ID:kenkode,项目名称:gasexpress,代码行数:11,代码来源:OrdersController.php

示例8: savePayments

 private function savePayments()
 {
     $rules = array();
     $recommendedId = Input::get('recommendedGateway_id');
     if ($gatewayId = $recommendedId == 1000000 ? Input::get('gateway_id') : $recommendedId) {
         $gateway = Gateway::findOrFail($gatewayId);
         $paymentLibrary = $gateway->paymentlibrary;
         $fields = $gateway->getFields();
         foreach ($fields as $field => $details) {
             if (!in_array($field, ['testMode', 'developerMode', 'headerImageUrl', 'solutionType', 'landingPage', 'brandName'])) {
                 if (strtolower($gateway->name) == 'beanstream') {
                     if (in_array($field, ['merchant_id', 'passCode'])) {
                         $rules[$gateway->id . '_' . $field] = 'required';
                     }
                 } else {
                     $rules[$gateway->id . '_' . $field] = 'required';
                 }
             }
         }
     }
     $creditcards = Input::get('creditCardTypes');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('company/payments')->withErrors($validator)->withInput();
     } else {
         $account = Account::findOrFail(Auth::user()->account_id);
         if ($gatewayId) {
             $accountGateway = AccountGateway::createNew();
             $accountGateway->gateway_id = $gatewayId;
             $config = new stdClass();
             foreach ($fields as $field => $details) {
                 $value = trim(Input::get($gateway->id . '_' . $field));
                 if ($value && $value === str_repeat('*', strlen($value))) {
                     Session::flash('error', trans('validation.notmasked'));
                     return Redirect::to('company/payments');
                 }
                 $config->{$field} = $value;
             }
             $cardCount = 0;
             if ($creditcards) {
                 foreach ($creditcards as $card => $value) {
                     $cardCount += intval($value);
                 }
             }
             $accountGateway->config = json_encode($config);
             $accountGateway->accepted_credit_cards = $cardCount;
             $account->account_gateways()->delete();
             $account->account_gateways()->save($accountGateway);
             Session::flash('message', trans('texts.updated_settings'));
         } else {
             Session::flash('error', trans('validation.required', ['attribute' => 'gateway']));
         }
         return Redirect::to('company/payments');
     }
 }
开发者ID:poseidonjm,项目名称:invoice-ninja,代码行数:55,代码来源:AccountController.php


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