本文整理匯總了PHP中Images::orderBy方法的典型用法代碼示例。如果您正苦於以下問題:PHP Images::orderBy方法的具體用法?PHP Images::orderBy怎麽用?PHP Images::orderBy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Images
的用法示例。
在下文中一共展示了Images::orderBy方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
/**
* Show view of homepage with public images (latest 6 images).
*
* @return object View
*/
public function index()
{
return View::make('main/index')->with('title', 'Homepage')->with('images', Images::orderBy('created_at', 'desc')->where('private', 0)->limit(6)->get());
}
示例2: updateSiteMap
public function updateSiteMap()
{
$sitemap = App::make("sitemap");
$posts = Images::orderBy('created_at', 'desc')->get();
foreach ($posts as $post) {
$sitemap->add(url('image/' . $post->id . '/' . $post->slug), $post->updated_at, '0.9');
}
$sitemap->store('xml', 'sitemap');
return Redirect::to('admin')->with('flashSuccess', 'sitemap.xml is now updated');
}
示例3: index
/**
* Showing list of public images (marked as 0 in private table).
* Pagination by 42 items per page (infinite scrolling).
*
* @return object View
*/
public function index()
{
return View::make('images/list')->with('title', 'List of images')->with('images', Images::orderBy('created_at', 'desc')->where('private', 0)->paginate('42'));
}
示例4: showImages
/**
* Showing list of users images
*
* @return object View
*/
public function showImages()
{
return View::make('user/index')->with('title', 'List of images')->with('images', Images::orderBy('created_at', 'desc')->where('user_id', Auth::user()->id)->get());
}