Question: sorry for asking sort of easy question but I'd like to clear the confusion of mine. Have been searching the net but mostly works with static models. I am currently trying to find a better way to execute these as the models will be dynamic (new database to work with each week or so) and I just thought there would be a better way instead or iterating the classes. I am new with this framework and really hope if you could spill your ideas to show the better way other than my code below.  
I would say raw query is somehow easier but I'd like to use eloquent instead. 

```
use App\lifting as data1;
use App\test1 as data2;
use App\test2 as data3;

class dataController extends Controller
{
    public function index()
    {
        $datas = array(data2::count(), data1::count(), data3::count());

        return $datas;
    }
}

```

Sure it's working and I know it's quite beginner level but you get the idea...

Thanks.

[EDIT]

When I say better way I mean like keeping the models in one collection and just use foreach something like that to get the total rows of each table. 

Thanks.

[EDIT 2]

It has been ages. To clarify, I'd solved it already by referring the tables with their respective id (create a new model that stores all the tables) and each time I need a specific table to show up, I'd just refer to its id.

Thanks.

Answer: 
For ascending:

```
days.sort();

```

For descending:

```
days.sort().reverse();

```
Here we have two functions to sort dates in both ascending and descending order.

```
var date_sort_asc = function (date1, date2) {
  if (new Date(date1) > new Date(date2)) return 1;
  if (new Date(date1) < new Date(date2)) return -1;
  return 0;
};

var date_sort_desc = function (date1, date2) {
  if (new Date(date1) > new Date(date2)) return -1;
  if (new Date(date1) < new Date(date2)) return 1;
  return 0;
};

```

Now you can sort them by calling these functions as a callback inside sort function like - 

```
days.sort(date_sort_asc);
days.sort(date_sort_desc);

```