2
My query returns the birthday boys correctly, but when sorting by table column it sorts by year and by day.
This is my query
$birthday = \App\Admin\Clients::whereMonth('birthday', \Carbon\Carbon::now()->month)
->orderBy('birthday', 'asc')->get();
I tried to use an array in sorting this way orderBy(['DAY', 'birthday'], 'asc')
, but I can only use the column name.
I tried with WhereBetween
, but unsuccessfully as well. There are other ways to do this sort of ordering?
birthday
is what kind of value?– novic
Is field
DATE
in the database– WMomesso
weird guy
orderBy('birthday')
, but, it is that you also take the random years neh? if you want to catch how, explains? because it is only filtering by month, !– novic
You found the solution, but you don’t quite understand what it’s for... there’s an addendum to your answer in the comments
– novic
Tomorrow I will edit the answer to improve my and everyone’s understanding.
– WMomesso
Read this: https://laravel.com/docs/5.7/queries#raw-methods
– novic