calculate difference (carbon), to save extra database field

Posted 2 months ago by jaheller

Hi at all, I'm a bit unsure, if there's a way for my problem to be solved WITHOUT using an extra database field to save the "shipment_date_sent' date.

I'm using a database field called time_for_shipment, this field contains the date, on which a product should be shipped.

I would like to remind the seller about "shipping" the item, if half of the time_for_shipment has passed. Any idea how I could retrieve all models, where 'half of" time_for_shipment has passed?

The time_for_shipment is calculated by using Carbon::now()->addSeconds($model->seconds_to_ship), so the seconds to accept would be available. Is there any way to use some kind of "back calculation" inside the query? I would like to avoid an extra field to store the date when the order was "marked as reminded".

Please sign in or create an account to participate in this conversation.