This episode is for members only

Sign up to access "Build An Uptime Monitor with Inertia" right now.

Get started
Already a member? Sign in to continue
Playing
25. Updating the job

Episodes

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

Transcript

00:00
Before we update our job to store the response we get back in our new checks table, we're just going to take a moment to update the frequency just so we don't need to wait around for as long. So I'm going to go ahead and set these to 10 seconds just to make this a little
00:15
bit quicker so we can get a little bit more feedback about what we're building. Okay, so we've already seen some of the methods that the HTTP client in Laravel gives us, and we know that we have the checks relationship on the endpoint model now. So really what we can do underneath here is access the endpoint checks relationship and just create a record out in here
00:39
for every single check that we perform. And we know that we want to go ahead and store the response code, and we want to potentially, if the request was successful or not successful, store the response body. So the response code is pretty straightforward. We're going to go ahead and access the response and grab the status from it. So let's just put in there directly,
01:02
but with the response body we want a condition in here. So if the response was successful or was not successful, we want to go ahead and store the response body. Otherwise, of course, we just want to store a null value. So let's just access that as a method, and we are done. Okay, so the next checks in here, let's just go ahead and set these to the current date and time, like so. And we're
01:29
going to come over to our console here, and we're going to go ahead and run our short schedule. So let's run that, and we can head straight over to the database under the checks here, and you can see that already these checks are being performed. We've lowered the frequency here to 10 seconds, which means that if I just keep on refreshing this, sure enough in 10 seconds
01:47
we start to see the rest of the checks roll in. Now let's just go over to our endpoint and just change this over to something that doesn't exist again, like pricing. And if we save the changes here and come over to checks, sure enough in a few seconds we should see the response code set to 404, and we should see a response body in there as well, which we do.
44 episodes4 hrs 59 mins

Overview

Ready to dive into Inertia? Let's build a real-world app with Laravel, Inertia and Vue! If you're already working with Inertia, you'll pick up some tips and techniques for future projects.

This uptime monitor allows you to create and switch between sites, then add endpoints to monitor with frequency intervals. Using the power of scheduling and queues, it'll automatically alert the email addresses you've added via the UI when an endpoint goes down.

In this course, you'll learn to:

  • Build a real app from scratch with Inertia
  • Work with Laravel queues
  • Perform actions on models at user-defined intervals
  • Work with sub-minute schedules in Laravel
  • Send out channel notifications with Laravel
  • Use API resources to simplify Inertia data
  • Organise apps with events and observers
  • Create modals in Vue
  • Perform inline editing with Inertia forms
Alex Garrett-Smith
Alex Garrett-Smith
Hey, I'm the founder of Codecourse!

Episode discussion

No comments, yet. Be the first!