javascript – {LARAVEL} How to Create a timer for claim reward?

My Name is Adhetya – I’m making a new project related to games in Laravel.
I want to ask if anyone here understands or has ever made a project about a game?
First thing is, I want to make rewards every hour using laravel.

I have implemented a simple countdown with javascript and database queries.

This javascript I use:
var countDownDate = new Date(“{!! $rewards !!}”).getTime();

                           var x = setInterval(function() {
                            var now = new Date().getTime();
                               var distance = countDownDate - now;
                               var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
                                var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
                                var seconds = Math.floor((distance % (1000 * 60)) / 1000);
                               var confirmButton = document.getElementById("bonus");
                               confirmButton.innerHTML = hours + " Hours " + minutes + " Minutes " + seconds + " Second Later";
                               if (distance < 0) {
                                   clearInterval(x);
                                   confirmButton.className = "btn btn-success btn-raised btn-lg";
                                   confirmButton.innerHTML = "Claim Now! <i class='fad fa-check-double'>";
                                   confirmButton.setAttribute('href','{{route('userDailyBonus')}}');
                               }
                           }, 1000);
                       </script>

Just info, $rewards
is what I took from the query $ user->bonus
$user->bonus
is a query that is intended so that members can only claim at that time.
I’m validated this with ($user->bonus < $now )
Are there other ways to help me and be more effective?

Thank you