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


PHP Client::findOrFail方法代码示例

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


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

示例1: update

 public function update($id, $requestData)
 {
     $client = Client::findOrFail($id);
     $client->fill($requestData->all())->save();
 }
开发者ID:Bottelet,项目名称:Flarepoint-crm,代码行数:5,代码来源:ClientRepository.php

示例2: bulk

 public function bulk()
 {
     $action = Input::get('action');
     $ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
     switch ($action) {
         case 'invoice':
             $expenses = Expense::scope($ids)->get();
             $clientId = null;
             $data = [];
             // Validate that either all expenses do not have a client or if there is a client, it is the same client
             foreach ($expenses as $expense) {
                 if ($expense->client_id) {
                     if (!$clientId) {
                         $clientId = $expense->client_id;
                     } elseif ($clientId != $expense->client_id) {
                         Session::flash('error', trans('texts.expense_error_multiple_clients'));
                         return Redirect::to('expenses');
                     }
                 }
                 if ($expense->invoice_id) {
                     Session::flash('error', trans('texts.expense_error_invoiced'));
                     return Redirect::to('expenses');
                 }
                 $account = Auth::user()->account;
                 $data[] = ['publicId' => $expense->public_id, 'description' => $expense->public_notes, 'qty' => 1, 'cost' => $expense->present()->converted_amount];
             }
             $clientPublicId = $clientId ? Client::findOrFail($clientId)->public_id : '';
             return Redirect::to("invoices/create/{$clientPublicId}")->with('expenses', $data);
             break;
         default:
             $count = $this->expenseService->bulk($ids, $action);
     }
     if ($count > 0) {
         $message = Utils::pluralize($action . 'd_expense', $count);
         Session::flash('message', $message);
     }
     return Redirect::to('expenses');
 }
开发者ID:jbagaresgaray,项目名称:invoiceninja,代码行数:38,代码来源:ExpenseController.php

示例3: update

 /**
  * Mise à jour dans la base de donnée en utilisant l'Id de la personne.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update($id)
 {
     try {
         $input = Input::all();
         $client = Client::findOrFail($id);
         $client->prenom = $input['prenom'];
         $client->nom = $input['nom'];
         $client->adresse = $input['adresse'];
         $client->ville = $input['ville'];
         $client->noTel = $input['noTel'];
         $client->courriel = $input['courriel'];
         $client->relation = $input['relation'];
         $client->actif = $input['actif'];
     } catch (ModelNotFoundException $e) {
         App::abort(404);
     }
     if ($client->save()) {
         return Redirect::action('ClientsController@index');
     } else {
         return Redirect::back()->withInput()->withErrors($client->validationMessages());
     }
 }
开发者ID:GBEY0402,项目名称:LesCuirsBermont3.0,代码行数:28,代码来源:ClientsController.php


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