当前位置: 首页>>代码示例>>PHP>>正文


PHP Picture::orderBy方法代码示例

本文整理汇总了PHP中Picture::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Picture::orderBy方法的具体用法?PHP Picture::orderBy怎么用?PHP Picture::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Picture的用法示例。


在下文中一共展示了Picture::orderBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getFeed

 public function getFeed()
 {
     $feed = Feed::make();
     //$feed->clearCache();
     $feed->setCache(180, 'shantavo-feed');
     if (!$feed->isCached()) {
         $pictures = Picture::orderBy('uploaded_at', 'desc')->take(20)->get();
         $feed->title = 'Нещо Шантаво';
         $feed->description = 'Последни снимки';
         $feed->link = 'https://neshto.shantavo.com/';
         $feed->logo = "https://neshto.shantavo.com/favicon.png";
         $feed->icon = "https://neshto.shantavo.com/favicon.png";
         $feed->pubdate = $pictures[0]->uploaded_at;
         $feed->lang = 'bg';
         $feed->setDateFormat('datetime');
         foreach ($pictures as $picture) {
             $feed->add($picture->title, $picture->user->username, secure_url('picture/' . $picture->id), $picture->uploaded_at, $picture->title, $picture->title);
         }
     }
     return $feed->render('atom');
 }
开发者ID:straho99,项目名称:NeshtoShantavo,代码行数:21,代码来源:HomeController.php

示例2: getNew

 public function getNew()
 {
     $pictures = Picture::orderBy('uploaded_at', 'DESC')->paginate(12);
     // layouts variables
     $this->layout->title = 'Последно качени | Нещо Шантаво';
     $this->layout->canonical = 'https://neshto.shantavo.com/category/new';
     $this->layout->robots = 'index,follow,noodp,noydir';
     $this->layout->description = 'Това е началната страница';
     $this->layout->keywords = 'начало, нещо шантаво, team navy pier';
     // nesting the view into the layout
     $this->layout->nest('content', 'category.new', array('pictures' => $pictures));
 }
开发者ID:straho99,项目名称:NeshtoShantavo,代码行数:12,代码来源:CategoryController.php


注:本文中的Picture::orderBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。