Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

david2000's avatar

training & appointment

I have a table named "Training" with 4 fields (date_seance, hour_start, hour_end, fk_bike).

My first problem is that I can not plan dates in advance.

For example, if I reserve a date on 01/09/2019 for the bike 000001. It works but if, I must to book another booking on 02/09/2019 with the same bike. So, 000001 I don't see the bike 000001 in my dropdownlist.

Do you have an idea ? Please...

public function index()
{
    $trainings = Training::oldest()->paginate(5);
    return view('admin.trainings.index', compact('trainings'))
      ->with('i', (request()->input('page',1) -1)*5);
}
public function store(Request $request)
    {   

        $request->validate([
                 'date_seance' => 'required',
         'hour_start' => 'required',
             'hour_end' => 'required',
                 'fk_bike' => 'required'
        ]);

        Training::create($request->all());

        return redirect()->route('trainings.index')
                ->with('success', 'new data created successfully');
    }

I thank you for your help and your time.

0 likes
1 reply
vandan's avatar

first of all bike field add one more field called status when someone book your bike 00001 then status field add 1 then dropdown check if status value 1 then cant show bike every user same process just try this

2 likes

Please or to participate in this conversation.