本文整理汇总了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();
}
}
}
示例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);
}
}
示例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');
}