本文整理汇总了PHP中Control::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Control::find方法的具体用法?PHP Control::find怎么用?PHP Control::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Control
的用法示例。
在下文中一共展示了Control::find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($controlTestId)
{
$control = Control::find($controlTestId);
$controlTest = ControlTest::find($controlTestId);
$controlTest->entered_by = Auth::user()->id;
$controlTest->control_id = $controlTest->control->id;
$controlTest->save();
foreach ($controlTest->control->controlMeasures as $controlMeasure) {
$controlResult = ControlMeasureResult::where('control_measure_id', $controlMeasure->id)->where('control_test_id', $controlTest->id)->first();
$controlResult->results = Input::get('m_' . $controlMeasure->id);
$controlResult->control_measure_id = $controlMeasure->id;
$controlResult->control_test_id = $controlTestId;
$controlResult->save();
}
return Redirect::route('control.resultsIndex')->with('message', trans('messages.success-updating-control-result'));
}
示例2: qualityControlResults
/**
* Returns qc results for a specific control page
*
* @param Input - controlId, date range
* @return view
*/
public function qualityControlResults()
{
$rules = array('start_date' => 'date|required', 'end_date' => 'date|required', 'control' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
} else {
$controlId = Input::get('control');
$endDatePlusOne = date_add(new DateTime(Input::get('end_date')), date_interval_create_from_date_string('1 day'));
$dates = array(Input::get('start_date'), $endDatePlusOne);
$control = Control::find($controlId);
$controlTests = ControlTest::where('control_id', '=', $controlId)->whereBetween('created_at', $dates)->get();
$leveyJennings = $this->leveyJennings($control, $dates);
return View::make('reports.qualitycontrol.results')->with('control', $control)->with('controlTests', $controlTests)->with('leveyJennings', $leveyJennings)->withInput(Input::all());
}
}
示例3: testDestroy
/**
* Testing Control destroy funciton
*/
public function testDestroy()
{
$this->action('DELETE', 'ControlController@destroy', array(1));
$control = Control::find(1);
$this->assertNull($control);
}