This episode is for members only

Sign up to access "Build an Appointment Booking System With Livewire" right now.

Get started
Already a member? Sign in to continue
Playing
16. Using a custom date collection

Episodes

0%
Your progress
  • Total: 3h 4m
  • Played: 0m
  • Remaining: 3h 4m
Join or sign in to track your progress

Transcript

00:00
Let's go ahead and swap out this plain collection
00:02
that we've created here to push all of our days due to a custom collection. There's a really good reason for that. This is going to be the source of truth for all of the slots
00:10
that we create. At the moment, it's a little bit wonky because we've got too many slots. We're not pushing any employees there.
00:16
But I'm going to create this now because then later what we can do is add some helper methods to this date collection. And we're going to be doing two main things with this date
00:24
collection. The first one is grabbing the first available date. So we can go through all of the dates that we've got in here, check if they're empty, and grab out the first available one.
00:33
And we can also use this to check if we have any slots for that particular day. So we'll create this now. And then later on, it's just going
00:40
to be a breeze to just add more methods into this collection. OK, so to do this, we just go ahead and create out a standard class in here. And we're going to call this DateCollection.
00:50
Now, we can choose what this extends. You can do this manually if you're not using something like phpStorm. But we're basically just going to choose
00:56
that we want to extend the IlluminateSupportCollection class. And we're done. So if not, just go ahead and extend that manually.
01:04
OK, so now we've done that. We're going to leave everything alone in here. I'm not going to touch anything just in here yet. But we are going to switch this over to a new DateCollection.
01:14
And there we go. Perfect. So this is going to work in exactly the same way. Give it a refresh.
01:19
The only difference here is that we now have a DateCollection. We've got everything inside of it. It functions just like a normal collection. But we can add any help methods in here that we need.
36 episodes3 hrs 4 mins

Overview

Building an availability calendar and booking system is a notoriously difficult problem to solve. That’s exactly what we’re going to cover in this course.

Step by step, we’ll build an appointment slot generator that calculates availability based on employee schedules, employee’s booked time off, the length of service chosen, existing appointments, and cancelled appointments.

For maximum flexibility, we’ll also allow multi-employee availability checks, so we’ll be able to see every employee who can perform a service (and their available slots).

To finish up, we’ll create an entire booking flow with Livewire, including a beautiful booking calendar that shows detailed availability across multiple dates, the ability to choose a time slot — and finally the ability to book an appointment.

Phew. We’ve got a lot to learn — let’s build a booking system with Livewire!

Alex Garrett-Smith
Alex Garrett-Smith
Hey, I'm the founder of Codecourse!

Comments

No comments, yet. Be the first to leave a comment.