【发布时间】:2018-07-09 14:46:16
【问题描述】:
在我的应用程序中,默认情况下,所有索引视图都按名称 ASC 排序。 我需要按 ID desc 对数据进行排序,只有在添加新行之后,才能帮助用户在索引顶部看到最后添加的行。
在控制器中,添加函数:
if ($this->Assets->save($asset)) {
$this->Flash->success(__('The asset has been saved.'));
//die('new id:' . $asset->id);
return $this->redirect(['action' => 'index']);
}
这个尝试没有成功:
return $this->redirect(['action' => 'index', 'order' => ['id' => 'DESC']]);
我该怎么办?
【问题讨论】:
标签: php cakephp cakephp-3.x