lundi 19 juillet 2021

Laravel- Check the manual that corresponds to your MariaDB server version for the right syntax to use near ') < Now()' at line 1

I keep getting this error when executing my program with Laravel:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') < Now()' at line 1 (SQL: select count(*) as aggregate from `house` where `isoccupied` = 0 and (currentdatasync + INTERVAL '1 DAY') < Now())

my function in my controller is:

  public function view()
    {
        $failed = DB::table('house')
            ->where('isoccupied', 0)
            ->whereRaw("(currentdatasync + INTERVAL '1 DAY') < Now()")
            ->count('*');

        return view('admin.dashboard')->with('failed', $failed);
    }

I have tried to use

return view('admin.dashboard')->with(compact($failed));

however it still does not work.

Has anyone experienced this before?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3wQssIa
via IFTTT

Aucun commentaire:

Enregistrer un commentaire