本文整理汇总了PHP中Client::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::orderBy方法的具体用法?PHP Client::orderBy怎么用?PHP Client::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client::orderBy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIndex
/**
* Returns all the clients.
*
* @return View
*/
public function getIndex()
{
// Get all the clients
$clients = $this->client->orderBy('created_at', 'DESC')->paginate(10);
// Show the page
return View::make('site/clients/index', compact('clients'));
}
示例2: destroy
public function destroy($id)
{
$delete = Client::find($id);
$delete->delete();
$data = array('clients' => Client::orderBy('id', 'desc')->get(), 'refresh' => true);
return View::make('clients.table', $data);
}
示例3: store
public function store()
{
$rules = array('id' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->passes()) {
//pasó validacion y guarda
} else {
//mensajes de error si faltan dartos
if (Request::ajax()) {
$data = array('errors' => $validator->errors(), 'inputs' => Input::all());
//regresa a la vista de crear
return View::make('clients.create', $data);
}
return 0;
}
$data = array('clients' => Client::orderBy('id', 'desc')->get(), 'refresh' => true);
return View::make('clients.table', $data);
}
示例4: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$items = Client::orderBy('name', 'ASC')->paginate(10);
return View::make('client.view_client', compact('items'));
}
示例5: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$clients = Client::orderBy('company')->get();
return View::make('clients.index')->withClients($clients);
}