angelica deviana
angelica deviana

Reputation: 29

Laravel add 30 minutes to created_add for expired

and I want to show all data in table Transaction using Laravel I'm using index.blade.php into Table so, when someone makes a transaction, I give them 30 mins. example startTime= 2020-04-26 21:04:00endTime should be= 2020-04-26 21:34:00 so when current time= 2020-04-26 21:24:00, that row will change to yellow whencurrent time= 2020-04-26 21:32:00````, that row will change to red What should I do?

this is my index this is my transaction.php this is my transactionController@index this is my transactionControlelr@store this is my create table transaction

Upvotes: 0

Views: 708

Answers (1)

lewis4u
lewis4u

Reputation: 15047

If you want to add 30 min to some time just do this:

[
    startTime => date('Y-m-d H:i:s'),
    endTime   => date('Y-m-d H:i:s', strtotime('+30 minutes'))
]

If you need to add 30min to some specific datetime, then use this:

$specificDateTime = '2020-04-26 21:32:00';
$increased = date('Y-m-d H:i:s', strtotime($created_at . '+30 minutes')); 

Upvotes: 1

Related Questions