not sure about it, but give it a try
//if you want to support multiple databases, switch the code, depending on DB::getDriverName()
//...
$weeks = Book::whereRaw("CAST (strftime('%w', date) AS Integer) = " . date('N'))->get();
i want to see all records based on dayofweek. this is my code:
$weeks = Book::whereRaw('WEEKDAY(created_at) = WEEKDAY(TODAY())')->get();
its good with mysql database but when i switch to sqlite, it wont accept the WEEKDAY() function. i need sqlite database.. is there any way to compare dayofweek on created_at and day today?
not sure about it, but give it a try
//if you want to support multiple databases, switch the code, depending on DB::getDriverName()
//...
$weeks = Book::whereRaw("CAST (strftime('%w', date) AS Integer) = " . date('N'))->get();
Please or to participate in this conversation.