Question: I am using Laravel 4.2, with server side jQuery data-tables.

Package: <https://github.com/Chumper/Datatable>

How can I add custom sorting ?

like for columns of currency, time, etc

Answer: 
If you are trying to sort the collection or query result in any order, you can do something like this:

```
$orders = Order::all()->SortBy('currency','desc');

```

or

```
$customers = Customers::where('age',$age)->orderBy('currency','desc')->get();

```

By the way, why are you still on Laravel 4 when there is Laravel 8 already?
Not sure if by `custom sorting` you mean sorting the rows by clicking on the headers? If that is what you mean then you can define them on the client side by defining the datatable settings.

```
oSettings = $("#{{$table->getId()}}").dataTable().fnSettings();
oSettings.aaSorting = [[6, 'desc']];

```

But if you want to maintain a default sorting of a particular column when the datatable loads, then

```
Datatable::table()
        ->addColumn($theader)       // these are the column headings to be shown
        ->setOptions('order', array([$ordercolumn ,"desc"]))
        ->setUrl(route('route.name', $form_id))   
        ->render()

```

I hope this helps.