I'm creating a project that needs a scheduling system that would work more or less like this: I have an user (student) and also another user (teacher). I want to give the teacher the ability to choose the days and hours of the day that he is available then the user can choose one of those open hour on the calendar and take as a time for tutoring.
Any idea on how I can create that or if there's a package already?
It's more or less like Google Calendar to be honest.
You need to keep track of a teacher's available time . There can be any number of approaches that you can implement. Here is an example
create this table
teacher_available_timings
id
id_teacher
start_timestamp
end_timestamp
use any javascript calendar library to render the calendar on front end
Use the data form the above table to keep those calendar cells enabled so that the user can choose from those cells only.
But again, there is not a straight forward answer to this. Its a design level question and the approach you choose may affect many aspects of your project.
You should read https://tools.ietf.org/html/rfc5545 to understand recurrent events design. Then there are a lot of libraries at github that will help you in the implementation. Recently I've used https://github.com/tplaner/When for a remainder system and it works pretty well!
@zefex you can keep the datatype as timestamp. Then you can query out something like 'give me this teacher's available hours for this perticular date'. And you will get the list of records if existed.
It is not actually that complicated @zefex . Once you get a good grip on working around such complexity, this will be a piece of cake for you (: Good luck !