本文整理匯總了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;
}
}