What do you think is the best way to do this?

I have a schedule table where users can enter their schedules. Based on that schedule (which should be hours a o'clock or half past) I create slots (in the slots table of my database) of 30 min to schedule appointments. Here is an example: The user sets his schedule on Mondays from 10:00 to 12:00. When saving it in the Schedule table, the following available slots are automatically created in the slots table like this: (FK) schedule_id: 1 time_start: 10:00 time_end: 10:30 status: 'available (FK) schedule_id: 1 time_start: 10:30 time_end: 11:00 status: 'available (FK) schedule_id: 1 time_start: 11:00 time_end: 11:30 status: 'available (FK) schedule_id: 1 time_start: 11:30 time_end: 12:00 status: 'available should I work with a custom function in the Create file of my Schedules resource (CreateSchedule)? maybe something with beforeCreate()? what do you suggest me? Btw, currently the user already has the Schedule tab, where he can enter the day, and the start and end time of his working day. I would like some suggestion on how to implement the slots. Thanks in advance
Solution:
sorry I didn't answer sooner. Thank you very much for replying. Unfortunately I am very tight on time and can't afford to follow a course right now. Anyway, in case anyone is interested, I'm doing it with the CreateSchedule page, adding some things in a afterCreate() function. Through this function, that is always executed everytime you create a schedule, I create the Slots. Is this the best way to do it? possibly not (certainly not). But it works and for the moment it works for me hahaha.
Jump to solution
3 Replies
tuto1902
tuto19022w ago
I would highly suggest that (if it's within your possibilities) you watch this course on codecourse.com https://codecourse.com/courses/build-an-appointment-booking-system-with-livewire I wish I had known the things I learned from this course back when I was building the Pet Clinic because this approach is way better than mine. I implemented something similar in the Text To Ads project I created recently. Granted, it was modified accordingly to fit the project theme, but there might be some useful information that you can use. I started implementing it in episode 2 https://www.youtube.com/live/miFTdyiYH5o I used Livewire (same as the course) but I'm sure the concepts can be easily applied to Filament as well.
Build an Appointment Booking System With Livewire
Building an availability calendar and booking system is a notoriously difficult problem to solve. That’s...
Tuto1902
YouTube
Text To Speech With Livewire 🎙️
Working on a cool Laravel project, live. Come join me!https://twitch.tv/tuto1902
Solution
Irissu
Irissu2w ago
sorry I didn't answer sooner. Thank you very much for replying. Unfortunately I am very tight on time and can't afford to follow a course right now. Anyway, in case anyone is interested, I'm doing it with the CreateSchedule page, adding some things in a afterCreate() function. Through this function, that is always executed everytime you create a schedule, I create the Slots. Is this the best way to do it? possibly not (certainly not). But it works and for the moment it works for me hahaha.
Irissu
IrissuOP2w ago
Anyway, I will keep the course to follow it later. Thank you so much

Did you find this page helpful?