Hey Alex, How are you! How can I implement Datatable to display EndPoints and Checks Data ?
I hope you are enjoying the course and learning a lot! If you happen to encounter the error message "SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB, TEXT, GEOMETRY or JSON column 'notification_emails' can't have a default value", there is a solution for you.
To resolve this issue, you can use the following code:
use Illuminate\Database\Query\Expression;
$table->json('notification_emails')->nullable()->default(new Expression('(JSON_ARRAY())'));
Hi Alex, the condition for the check recovery was also sending a recovery email for the first time you have a valid endpoint. I think it's due to this condition
1$check->endpoint->checks->count() >= 1
I changed to this and it's working as expected
1$check->endpoint->checks->count() > 1
So my whole conditional logic looks like this now:
1if ($check->isSuccessful() && ! $check->previous()?->isSuccessful() && $check->endpoint->checks->count() > 1) {2 Log::info('Notify user endpoint recovery');3 EndpointRecovered::dispatch($check);4}
Thanks for this, I fixed this up in a later episode already :)
I have a question related to episode 5:
Is there any advantage of using an Object instead of an Array? If the only goal is to limit the data which gets exposed to the frontend, we can use something like this in the backend:
return Inertia::render('Dashboard', [ 'sites' => Site::get()->map(fn($site) => [ 'id' => $site->id, 'domain' => $site->domain ]) ]);
This way there would be no need to create an api resource. Sorry for the question, i'm an Inertia.js/Vue newbie and just want to figure things out.
By the way, the method above is from Episode 16 of the Laracasts Inertia Course: https://laracasts.com/series/build-modern-laravel-apps-using-inertia-js/episodes/16
page.props.value.endpointFrequencies
didn't work for me, instead page.props.endpointFrequencies
works.
I ought to share it here in case someone else faced a similar issue
I think it's because you are using intertia v1 which wasn't released when he started this course
Hi Alex, I'm getting a weird ordering of videos for the section "Checking Endpoints". The video sequence for me is 20, 24, 24, 30, 21, 25, etc.
Thanks, fixed!
I don't understand why you never publish code while uploading videos.
Each episode, a commit, like other creators do, like Jeffrey.
I am here not to steal your source code, but for learning purposes. Sometimes I have time to follow along, while others I while prefer to watch and see the source code.
Thanks for the feedback, and I agree. The main reason is that I'm tweaking and adding as I go, but this could be done with a GitHub repository. I'll work on this for future courses 👍
Hi Alex, If you cannot provide the course resource, I think it would be better if you could post the pre-made markup in the comment section so that we can follow the video.
Any markup used is in the resources section which you can toggle above the episode list. If you missed that, let me know and I'll work on making it clearer.
Yes, I missed that 😅. It turns out it is above the episode list. Thank you.
Thanks. We're due to work on the UI for the watch page, so I'll be making that clearer :)
Hi Alex. It seems the ordering of the lessons in this course is a bit messed up!?
Thanks, fixed!
Episode 6... is this not more complicated than it needs to be?
Could you not just store the default_site_id
on the user model?
Unless it's to teach people how to use Model Observers, then of course it makes sense.
You're right, it could be simpler. Perhaps a refactor for later :)
why I might be getting this message? Sorry Because of its privacy settings, this video cannot be played here.
This may be due to the country you're in. Our video provider is blocked in certain countries. A VPN would work around this.
M1 Mac will throw an error should you try to perform the http request without a queue. The error will be something along the lines of
1rosetta error: unexpectedly need to EmulateForward on a synchronous exception x86_rip=0x7fff203fbcdf arm_pc=0x7ffe94ad40d0 num_insts=5 inst_index=3 x86 instruction bytes: 0x56415741e5894855 0x89415053544155412[1] 17860 trace trap php artisan checks:perform
Hey everyone, I've tried to add a validation rule for updating the Endpoint Location. However, it's not working as it should be. I tried several variations with no luck.
Here are the validation rules that I've added. Maybe someone else tried to add this validation?
1public function rules(): array 2 { 3 return [ 4 'location' => [ 5 'required', 6 Rule::unique('endpoints')->where(fn ($query) => $query->where('site_id', $this->endpoint->site_id)), 7 ], 8 'frequency' => ['required', new Enum(EndpointFrequency::class)], 9 ];10 }
I want to validate uniqueness of a Location within the same Site_ID and irrespective of the location Endpoint ID (This is automatically ignored by Rule Unique Database)
There could be a problem in the framework itself. For now, I can resolve the issue as follows.
The code below checks for a uniqueness for the endpoint's location within the same site when updating an endpoint.
1public function rules(): array 2 { 3 return [ 4 'location' => [ 5 'required', 6 Rule::unique('endpoints', 'location') 7 ->where('site_id', $this->endpoint->site_id) 8 ->ignore($this->endpoint->id), 9 ],10 'frequency' => ['required', new Enum(EndpointFrequency::class)],11 ];12 }
I think episode 19 is broken 😅
You've caught a rare glimpse into an unedited Codecourse video 🙈
Thanks for letting me know Sam, all sorted!
The deep breath at the beginning made me chuckle... Good job as usual though Alex ;)
can i know what extension make -> a perfect arrow? and other useful vs code extensions you use for laravel development?
Try to set the font of your editor to somethinike this ...
https://github.com/tonsky/FiraCode
For anyone that needs the Endpoint template:
1<template> 2 <tr> 3 <td class="whitespace-nowrap pl-4 sm:pl-6 px-3 text-sm font-medium text-gray-900 w-64"> 4 <a href="/" class="text-indigo-600 hover:text-indigo-900"> 5 Location 6 </a> 7 </td> 8 <td class="whitespace-nowrap px-3 text-sm text-gray-500 w-64"> 9 Frequency10 </td>11 <td class="whitespace-nowrap px-3 text-sm text-gray-500 w-64">12 Last Check13 </td>14 <td class="whitespace-nowrap px-3 text-sm text-gray-500 w-64">15 Status16 </td>17 <td class="whitespace-nowrap px-3 text-sm text-gray-500 w-64">18 x%19 </td>20 <td class="whitespace-nowrap pl-3 pr-4 text-right text-sm font-medium sm:pr-6 w-32">21 <button class="text-indigo-600 hover:text-indigo-900">22 Edit23 </button>24 </td>25 <td class="whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6 w-16">26 <button class="text-red-600 hover:text-red-900">27 Delete28 </button>29 </td>30 </tr>31</template>
Hey! Alex, happy to see content on inertia, finally. Had been waiting for your take on this beautiful framework. Hope to fine-grain my understanding with your help. Cheers!
Hey Alex, I would use teleport to show the Modal.
Inside the SiteSelector.vue component, add the following:
1<teleport to="#modal-area" v-if="showNewSiteModal">2 <VueFinalModal v-model="showNewSiteModal">3 Modal content4 </VueFinalModal>5</teleport>
Then, open the app.blade.php and add this line right after @inertia
1<body class="font-sans antialiased">2 @inertia3 <div id="modal-area"></div>4</body>
You can use the route helper from ziggy in the SiteSelector component and refer to the route names used in web.php i.e. for the site list you can use
1:href="route('dashboard', { id: site.id})"
Nice! thanks for the tip
v-on:click="delete" doesnt he need to pass the endpoint.id? The endpoint object should have multiple endpoints in there, so I dont see how it knows which one to delete.
Make dd($endpoint) to see which one is deleted
Each listed endpoint is within its own component, so deleting removes the current endpoint that has been passed as a prop.