samedi 27 novembre 2021

Is that possible to use IF statement to get data from database and save it into String?

I want to get some record from tbl_jadwal and save it into string in my laravel. This is my code,

$get_time = if (now()->isMonday()) {
            return DB::table('tbl_jadwal')->where('Hari', 'Senin')->value('Jadwal_masuk');
        } else if(now()->isSaturday()) { {
            return DB::table('tbl_jadwal')->where('Hari', 'Sabtu')->value('Jadwal_masuk');
        };

$time = $get_time;

but i got message syntax error, unexpected token "if", is there any other way to solve this problem ?




Aucun commentaire:

Enregistrer un commentaire