lundi 2 mai 2016

How to say good morning and good evening based on time in laravel

I am try to say wishes to customer based on time.I have a wishes in db as a name of wishe based on the query result how to select the wishe column in db.

$wishes= DB::table('wishes')
        ->select(DB::raw("DATE(D.datumTijd)",
                 DB::raw("(CASE WHEN TIME(D.datumTijd) BETWEEN '08:00:00' AND '12:00:00' THEN 1
                          WHEN TIME(D.datumTijd) BETWEEN '14:00:00' AND '20:00:00' THEN 2
                          WHEN TIME(D.datumTijd) BETWEEN '20:00:00' AND '24:00:00' THEN 3
 END) as result")))->get()

;



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire