本文整理汇总了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');
}
示例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));
}