I'm using Laravel 4.2 and have a query builder object. The column I am trying to order by is nullable. When the value is null it treats it as the lowest value. I need to make it treat null as the highest value.
public function sort($builder, $direction = 'asc')
{
return $builder->orderBy('table.nullable_column', $direction);
}
Honestly I just need the null values to be last when sorting ascending and last when descending. Open to suggestions if Laravel doesn't have a way to handle this. Was unable to find anything else using google. Hopefully you guys can help.
Thanks!