I created an appends attribute in Laravel Model, from the code below.
protected $appends = array(\'total\'=>\'\');
And I set the returne
use sortBy for ASC
sortBy
$collection->sortBy('field');
use sortByDesc for DESC
sortByDesc
$collection->sortByDesc('field');