Ejemplo n.º 1
0
 /**
  * Order the current collection
  *
  * If the _order_column and _order_by is defined from http request, then this should override the 
  * default collection ordering.
  *
  * @param BaseCollection
  */
 protected function orderCollection(BaseCollection $collection)
 {
     $orderColumn = $this->request->param('_order_column');
     $orderBy = $this->request->param('_order_by');
     if ($orderColumn && $orderBy) {
         $collection->orderBy($orderColumn, $orderBy);
     } elseif ($this->defaultOrder) {
         $collection->orderBy($this->defaultOrder[0], $this->defaultOrder[1]);
     }
 }
Ejemplo n.º 2
0
 public function applyOrder(BaseCollection &$collection)
 {
     if (isset($this->data['orderBy']) && $this->data['orderBy']) {
         var_dump($this->data['orderBy']);
         foreach ($this->data['orderBy'] as $o) {
             $collection->orderBy($o[0], $o[1]);
         }
     }
 }