本文整理汇总了PHP中app\models\News::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP News::orderBy方法的具体用法?PHP News::orderBy怎么用?PHP News::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\News
的用法示例。
在下文中一共展示了News::orderBy方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function index(Request $request)
{
$Model = new News();
$News = $Model->orderBy('id', 'DESC');
$News = $this->paging($News, $request, false);
$data = ["title" => "Tin tức", 'news' => $News, 'total' => $this->total, 'total_page' => $this->total_page];
return View::make('user/news', $data);
}
示例2: getLogin
public function getLogin()
{
if (Auth::check()) {
return redirect('game');
}
$news = News::orderBy('date', 'desc')->paginate(3);
return view('auth/login', ['news' => $news]);
}
示例3: index
public function index()
{
$items = News::orderBy('created_at', 'desc')->take(10)->get();
$data = array();
foreach ($items as $k => $v) {
$data[] = array('title' => $v->title, 'description' => $v->content, 'link' => url($v->url));
}
$feed = Feeder::feed($data);
return Response::make($feed, 200, array('Content-Type' => 'text/xml'));
}
示例4: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$news = News::orderBy('created_at', 'DESC')->paginate(5);
return view('news.index', compact('news'));
}
示例5: index
public function index()
{
$news = Models\News::orderBy('created', 'desc')->get();
return view('news.list', ['news' => $news]);
}
示例6: getRolesPaginated
/**
* @param $per_page
* @param string $order_by
* @param string $sort
* @return mixed
*/
public function getRolesPaginated($per_page, $order_by = 'id', $sort = 'asc')
{
return News::orderBy($order_by, $sort)->paginate($per_page);
}
示例7: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$news = News::orderBy('id', 'desc')->paginate(10);
return view('admin.news.index', compact('news'));
}
示例8: latest
public static function latest($n = 6)
{
return News::orderBy('created_at', 'DESC')->limit($n)->get();
}