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