Use of Delete and get in crontab

Asked

Viewed 12 times

0

Closed. This question is out of scope and is not currently accepting answers. Despite being about programming, this question does not seem to meet the minimum criteria of quality and detail for a question and answer site. The questions here need to be for specific, practical or conceptual problems about algorithms, software programming and development tools and techniques. Improve the question.

Closed 4 hours ago.

(Private feedback for you)

I would like help to create a feature that removes sales after 2 hours of realized.

I tried to create the hourly function and use a get on crontab, but my solution did not work.

follows the excerpt of the code I made.

public Static Function hourly(){

//remove tickets with status 0

    \App\tickets::where('status',0)
        ->where('created_at','<',date("Y-m-d H:i:s", strtotime("2 hours ago")))->delete();

No error returns, but does not exclude sales.

Can someone help me understand where the mistake is.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.