Пример #1
0
 /**
  * @inheritdoc
  */
 public function ordering()
 {
     foreach ($this->request->orderableColumns() as $orderable) {
         $column = $this->getColumnName($orderable['column']);
         $this->collection = $this->collection->sortBy(function ($row) use($column) {
             $row = Helper::castToArray($row);
             return $row[$column];
         });
         if ($orderable['direction'] == 'desc') {
             $this->collection = $this->collection->reverse();
         }
     }
 }
 public function test_cast_to_array_an_array()
 {
     $class = ['id' => 1];
     $compiled = Helper::castToArray($class);
     $this->assertEquals(['id' => 1], $compiled);
 }