本文整理匯總了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();
}