php - sortBy() text doesn't work -


i have function in laravel framework witch parse order , sort query

private function parseorder($order, $query)     {         $columns = explode(',', $order);         foreach ($columns $column) {             if ($column[0] === '-') {                 $column = substr($column,1);                 $query->orderbydesc($column);             } else {                 $query->orderby($column);             }         }     } 

function work correctly order type int, when try use order type string function doesn't return data.

example of data:

"id": 1,         "title": "corporis maxime vero aperiam labore ipsum laborum repudiandae.",         "text": "possimus enim modi nihil saepe atque cum. est consequuntur ut commodi non dolores sint adipisci. non voluptas consequatur nam ratione velit et deleniti. corrupti rerum delectus voluptatem fugit.",         "image_id": 24,         "author_id": 24,         "source_id": 1,         "type_id": 1,         "editor_text": "esse labore odit voluptatum ea doloremque praesentium. asperiores id voluptatem et voluptatem. sequi sint expedita eum nam non pariatur ea. deleniti ut magni nihil eveniet.",         "recipe": "recipe: hatter. 'you might other.' there seemed sure, had never had fits, dear, , couldn't cut off head no chance of this, neck from.",         "recipe_link": "http://www.bradtke.net/",         "count_recipe_link_redirect": 998,         "recommended_at": "2017-08-16 12:28:21",         "created_at": "2017-08-17 13:13:44",         "updated_at": "2017-08-17 13:13:44",         "deleted_at": null 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -