當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Condition::find方法代碼示例

本文整理匯總了PHP中Condition::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP Condition::find方法的具體用法?PHP Condition::find怎麽用?PHP Condition::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Condition的用法示例。


在下文中一共展示了Condition::find方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: destroy_conditions

 public function destroy_conditions($id)
 {
     // Check if user has access to loan
     if (!$this->is_staff()) {
         Session::flash('alert_danger', 'Access denied.');
         return Redirect::to('dashboard');
     } else {
         try {
             // Organize data
             $loan = $this->loan->getById($id);
             $condition = Condition::find(Input::get('condition_id'));
             $condition->active = 0;
             $condition->save();
             // Save Transaction
             $transaction = new Transaction();
             $transaction->loan_id = $loan['id'];
             $transaction->user_id = $this->user->id;
             $transaction->transaction_type_id = "10";
             $transaction->updated_item_id = $condition->id;
             $transaction->transaction_description = "Condition Deleted: " . $condition->description;
             $transaction->save();
             // On success, redirect to show Loan
             Session::flash('alert_success', 'Deleted condition successfully.');
             return Redirect::to('loan/' . $loan['id']);
         } catch (\RuntimeException $e) {
             Session::flash('alert_danger', 'Failed to delete condition.');
             return Redirect::back()->withInput();
         }
     }
 }
開發者ID:julianfresco,項目名稱:documentHub,代碼行數:30,代碼來源:LoanController.php

示例2: editedAction

 /**
  * [editedAction description]
  * @param  [type] $id [description]
  * @return [type]     [description]
  */
 public function editedAction($id)
 {
     //return 'test-->'.$id;
     Input::flash();
     $data = Input::all();
     // 'min:3' ensures that the value is greater than or equal to the parameter provided
     // 'max:32' ensure that the value is less than or equql to the parameter provided
     $rules = array('conditionname' => array('min:3', 'required'), 'condition_action' => array('required'));
     // Build the custom messages array.
     $messages = array('conditionname.required' => 'กรุณาระบุชื่อเงื่อนไข', 'condition_action.required' => 'กรุณาระบุชื่อเงื่อนไขค้นหา', 'conditionname.min' => 'กรุณาระบุชื่อเงื่อนไขอย่างน้อย :min ตัวอักษร.');
     // Create a new validator instance.
     $validator = Validator::make($data, $rules, $messages);
     $cond_name = trim($data['conditionname']);
     $cond_action = trim($data['condition_action']);
     if ($validator->passes()) {
         // Normally we would do something with the data.
         $condition = new Condition();
         $rs_check = $condition->checkCondition($cond_name);
         if ($rs_check) {
             $condition = Condition::find($id);
             $condition->cond_name = $data['conditionname'];
             $condition->condition = $data['condition_action'];
             $condition->save();
             return Redirect::to('condition')->with('success', 'ชื่อเงื่อนไขรหัส = ' . $id . ' แก้ไขสำเร็จ');
         } else {
             return Redirect::to('condition-edit/' . $id)->with('warning', 'มีชื่อเงื่อนไขอยู่ในระบบแล้ว');
         }
     } else {
         //$errors = $validator->messages();
         return Redirect::to('condition-edit/' . $id)->withErrors($validator);
     }
 }
開發者ID:nattaphat,項目名稱:cuse2,代碼行數:37,代碼來源:ConditionController.php

示例3: updateTerm

 public function updateTerm($id)
 {
     if ($term = Condition::find($id)) {
         return View::make('admin.viewTerm')->withTerm(Condition::find($id));
     }
     return Redirect::back()->withErrors('Could not find reservation');
 }
開發者ID:jmramos02,項目名稱:catering,代碼行數:7,代碼來源:AdminController.php


注:本文中的Condition::find方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。