本文整理汇总了PHP中Parse\ParseQuery::addDescending方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseQuery::addDescending方法的具体用法?PHP ParseQuery::addDescending怎么用?PHP ParseQuery::addDescending使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse\ParseQuery
的用法示例。
在下文中一共展示了ParseQuery::addDescending方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processOrders
/**
* Apply order settings to the source
*
* @param array $settings
*/
protected function processOrders(array $settings = [])
{
foreach ($settings['orders'] as $column => $order) {
switch ($order) {
case Grid\Grid::ORDER_ASC:
$this->source->addAscending($column);
break;
case Grid\Grid::ORDER_DESC:
$this->source->addDescending($column);
break;
default:
break;
}
}
}
示例2: showNotifications
public function showNotifications(Request $request)
{
$current_user = ParseUser::getCurrentUser();
$query = new ParseQuery("Notifications");
$query->equalTo("for", $current_user);
$query->equalTo("read", false);
$query->includeKey('by');
$query->includeKey('message');
$query->addDescending('createdAt');
try {
$notifications = $query->find();
Html\Assets::addLink(Html\Link::Css(elixir('css/default.css')));
$renderData = $this->getRenderData($request);
$notes = array();
foreach ($notifications as $notify) {
if (!empty($notify->get('message'))) {
$byimage = $notify->get('by')->get('image');
$chatroom = $notify->get('message')->get('chatRoom');
$relation = $notify->get('message')->getRelation('asset');
$assets = $relation->getQuery()->find();
if (empty($chatroom)) {
continue;
}
$chatroom->fetch();
$notes[] = ['notification' => $notify, 'byimage' => $byimage, 'chatRoom' => $chatroom, 'assets' => $assets];
}
$notify->set("read", true);
$notify->save();
}
$renderData['user'] = $current_user;
$renderData['notifications'] = $notes;
return view('notification', $renderData);
} catch (\Exception $ex) {
echo $ex->getMessage();
die;
}
}