DilipkumarC
2 months ago
107
3
Laravel

Laravel check the date

Posted 2 months ago by DilipkumarC

Hi,

Is there the proper way to check the database date if smaller than "before date" then do the restriction?

currently What I have is

        if (count(Sale::where('date','<=' ,'2018-08-01')->get()) > 0 ) {
            echo "Sales is closed";
            return false;
        }else {
            echo "Sales is open";
            return true;
        }

The sale will closed for the date that before 2018-08-01 and new sale will open after the date.

Please sign in or create an account to participate in this conversation.