本文整理匯總了PHP中app\models\Project::orderby方法的典型用法代碼示例。如果您正苦於以下問題:PHP Project::orderby方法的具體用法?PHP Project::orderby怎麽用?PHP Project::orderby使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\Project
的用法示例。
在下文中一共展示了Project::orderby方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index($current_page)
{
$current_page = $current_page ? $current_page : 1;
$current_page = $current_page - 1;
$page = 10;
//echo $current_page*$page;exit;
$post = Project::orderby('projects_id', 'desc')->offset($current_page * $page)->limit($page);
$posts['data'] = $post->get();
$posts['count'] = Project::count();
$posts['pageSize'] = $page;
$posts['pageSize'] = $page;
return response()->json($posts);
}
示例2: addshow
public function addshow()
{
//網站列表
$data['websites'] = Website::orderby('websites_id', 'desc')->get();
$data['projects'] = Project::orderby('projects_id', 'desc')->get();
$data['posts_content'] = file_get_contents("http://www.doc.com/app/admin/tpl/posts/default.html");
return response()->json(['status' => true, 'message' => '數據查詢成功', 'data' => $data]);
}
示例3: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$data['card'] = $card = Card::find($id);
if ($card) {
$data['sectors'] = Sector::lists('name', 'id');
$data['districts'] = District::groupby($this->district)->lists($this->district, 'id');
$data['projects'] = Project::orderby('name', 'asc')->lists('name', 'id');
$data['listbtn'] = Permission::hasPermission('cards.update');
return view('cards.edit', $data);
} else {
Session::flash('danger', Lang::get('ruban.card.notfound'));
return Redirect::route('ruban.cards.index');
}
}