1 month ago

Laravel check the date

Posted 1 month ago by DilipkumarC


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.