in Education by
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago. Improve this question I will try to explain what I am trying to achieve. I am writing laravel json api with MySQL. Imagine user creates record inside my database. What I want to do is perform some kind of operation 24 hours after this record is created. It's something like cron job but what will be the the best solution? Should I run cron for example every 5 minutes and check if expired 24 hours for any of the records? Or maybe there is better solution? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You should use the Laravel queue system for this. When you insert a record in the database, you should create a new delayed job. Set the delay to 24 hours and Laravel will execute the job at that moment. AfterInsertJob::dispatch()->delay(now()->addHours(24));

Related questions

0 votes
    I'm trying to add foreign key in my table exam: public function up() { Schema::create('exams', ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    Set the cron job, but the order email will auto cc to other customers and I don't know why. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 14, 2022 in Education by JackTerrance
0 votes
    I have set up a cronjob to run a script daily. This script pulls out a list of Ids from a ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 20, 2022 in Education by JackTerrance
0 votes
    I have set up a cronjob to run a script daily. This script pulls out a list of Ids from a ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I am setting up authentication using Laravel (Laravel Framework version 5.8.4) as a REST API, but ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 12, 2022 in Education by JackTerrance
0 votes
    How to get ASP.NET Web API to return JSON instead of XML using Chrome?...
asked Jan 11, 2021 in Technology by JackTerrance
0 votes
    I have two queries like so, $q = $dbc -> prepare("UPDATE accounts SET motivation = motivation+100 ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 30, 2022 in Education by JackTerrance
0 votes
    Lalit is going for an interview for the job of Software developer in Reputed company. what point he should ... an effective interview. Select the correct answer from above options...
asked Dec 26, 2021 in Education by JackTerrance
0 votes
    Lalit is going for an interview for the job of Software developer in Reputed company. what point he should ... an effective interview. Select the correct answer from above options...
asked Dec 25, 2021 in Education by JackTerrance
0 votes
    Write the Port Numbers for NameNode, Task Tracker and Job Tracker?...
asked Jun 1, 2021 in Technology by JackTerrance
0 votes
    I am trying to create authentication using Laravel Passport, I have configured everything the right way as ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
0 votes
    I am working on a project that requires a secure connection. I can set the route, uri, asset to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    What System requirements for installation of Laravel framework ?...
asked Sep 30, 2021 in Technology by JackTerrance
0 votes
    How to turn off CRSF protection for specific route in Laravel?...
asked Sep 30, 2021 in Technology by JackTerrance
0 votes
    I have seen valid JSON written this way: { "version": 1 , "object": { "one": 1 , "two" ... questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
...