If hour start and hour end are Carbon instance then you can calculate time like this
$payment->hour_start->diffInMinutes($payment->hour_end);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have some hesitations about 3 tables which are type_training , training & payment.
In the table type_training, I have a field named price with 4 amounts: for example:
1 hour 00 = 100 euros
1 hour 30 = 150 euros
2 hour 00 = 200 euros
2 hour 30 = 250 euros
In my page Training , I encode 2 recordings for the same student.

The student Dujardin has booked 3 hours for 300 euros.
In my form Payment, is it possible to retrieve the amount of 300 ?

So, in my Model Payment? I must to calculate the difference between the hour start and the hour end?
I don't know how to do ?
Then, after having retrieved the difference of hours in my example we have 3 hours.
How to I sum my 2 recordings in my field Total ? I have tried this?
$typetraining = Typetraining::find($request->fk_typetraining);
$data = $request->all();
$data['total'] = $typetraining->price + $request->????;
Payment::create($data);
In summary:
How to retrieve the difference between hour start & hour end,
How to calculate the amounts via the duration of my training?
For information, here is my architecture.

I thank you for your help and your explanations.
If hour start and hour end are Carbon instance then you can calculate time like this
$payment->hour_start->diffInMinutes($payment->hour_end);
Please or to participate in this conversation.