I am stuck since several days concernng the checking betwen the number of training and the reservation.
For example: you pay 1 training (1 seance), you have 1 booking. we can not encode 2 bookings an error message appears. It's my but...
in my table Training, here is my fields (hour_start, hour_end, fk_motorbike, fk_former, fk_student, fk_payment)
and In my table Payment I have this (date_payment, number_seance, total, fk_student, method_payment)
In my screenshot, I have 1 payment for 1 seance

Here, the problem is that I can add several trainings, it's not limit to 1 seance.

do you have any idea how I could do that?
I tried this but without success
$seance = Payment::find($request->fk_payment);
if($request->seance >= $request->number_seance){
return redirect()->route('trainings.index')
->with('error', 'Limit! ');
}