本文整理汇总了PHP中News::order_by方法的典型用法代码示例。如果您正苦于以下问题:PHP News::order_by方法的具体用法?PHP News::order_by怎么用?PHP News::order_by使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类News
的用法示例。
在下文中一共展示了News::order_by方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_index
public function get_index()
{
$this->data['news'] = News::order_by('created_at', 'desc')->get();
return View::make('admin.' . $this->views . '.index', $this->data);
}
示例2: function
| Route::post(array('hello', 'world'), function()
| {
| return 'Hello World!';
| });
|
| It's easy to allow URI wildcards using (:num) or (:any):
|
| Route::put('hello/(:any)', function($name)
| {
| return "Welcome, $name.";
| });
|
*/
Route::get(array('/', 'home', 'sup', 'bro'), function () {
if (Auth::check()) {
return View::make('page.user_home')->with('news', News::order_by('created_at', 'DESC')->paginate(4));
}
return View::make('page.user.login');
});
/*
|--------------------------------------------------------------------------
| Application 404 & 500 Error Handlers
|--------------------------------------------------------------------------
|
| To centralize and simplify 404 handling, Laravel uses an awesome event
| system to retrieve the response. Feel free to modify this function to
| your tastes and the needs of your application.
|
| Similarly, we use an event to handle the display of 500 level errors
| within the application. These errors are fired when there is an
| uncaught exception thrown in the application.
示例3: get_overview
public function get_overview()
{
return View::make('page.admin.news.overview')->with('news', News::order_by('created_at', 'DESC')->paginate(25));
}