本文整理汇总了PHP中Control::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Control::orderBy方法的具体用法?PHP Control::orderBy怎么用?PHP Control::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Control
的用法示例。
在下文中一共展示了Control::orderBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUpdate
/**
* Testing Control Update function
*/
public function testUpdate()
{
$response = $this->action('POST', 'ControlController@store', $this->inputUpdateControls);
$this->assertTrue($response->isRedirection());
$this->assertRedirectedToRoute('control.index');
$testControl = Control::orderBy('id', 'desc')->first();
$this->assertEquals($testControl->name, $this->inputUpdateControls['name']);
$this->assertEquals($testControl->description, $this->inputUpdateControls['description']);
$this->assertEquals($testControl->lot_id, $this->inputUpdateControls['lot']);
$testControlMeasures = $testControl->controlMeasures;
foreach ($testControlMeasures as $key => $testControlMeasure) {
$this->assertEquals($this->inputUpdateControls['new-measures'][$key]['name'], $testControlMeasure->name);
$this->assertEquals($this->inputUpdateControls['new-measures'][$key]['unit'], $testControlMeasure->unit);
}
}
示例2: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$controls = Control::orderBy('id')->get();
return View::make('control.index')->with('controls', $controls);
}