Haleem Hosein liked a comment+100 XP
1mo ago
Haleem Hosein liked a comment+100 XP
1mo ago
@sebkay No kidding haha. Normally, I'd work on something else...but when recording, you just have to wait it out.
Haleem Hosein liked a comment+100 XP
1mo ago
Haleem Hosein liked a comment+100 XP
2mos ago
** Warning **
Do not just use ->markdown() on its own this is prome to XSS (Cross-Site-Scripting) if you was to put <img src="#" onmouseover="alert('hacked');" /> in your idea description or worse a user was, when they hover over the image, an alert will show. Instead use:
`return Attribute::get(
fn ($value, $attributes) => new HtmlString(str($attributes['description'])->markdown([
'html_input' => 'escape',
'allow_unsafe_links' => false,
'max_nesting_level' => 5,
])));`
Haleem Hosein liked a comment+100 XP
2mos ago
Haleem Hosein liked a comment+100 XP
2mos ago
Haleem Hosein liked a comment+100 XP
2mos ago
One important thing when creating routes like that, is the order.
Route::get('/ideas/create', [IdeaController::class, 'index']);
Must be defined before
Route::get('/ideas/{idea}', [IdeaController::class, 'show']);
Or you will scratch your head as to why you get a 404 when trying to navigate to the create Idea route.
Haleem Hosein liked a comment+100 XP
2mos ago
Haleem Hosein liked a comment+100 XP
3mos ago
First <3
@Jeffrey Way can you release a series on how to deploy a Laravel app with Docker in 2026 (maybe FrankenPHP)?
Haleem Hosein liked a comment+100 XP
3mos ago
Haleem Hosein liked a comment+100 XP
4mos ago
Quick note! At 13:07, we use the Bot's chat id to compare it to the authorized user id. Technically, this works for a private chat with the Bot. However, we should handle the possibility of group chats and channels by instead fetching the user directly. It's more clear that way, anyhow.
Use $bot->user()->id instead of $bot->chat()->id.
if ($bot->user()->id !== config('nutgram.authorized_user') {
$bot->sendMessage('You are not authorized to use this bot.');
}
Haleem Hosein liked a comment+100 XP
4mos ago
Haleem Hosein liked a comment+100 XP
4mos ago
@jorgen_ellera Excellent question!
You can have two separate context providers in different parts of your app — but if you do so, each one will hold its own separate state, independent of the other.
If you want the two parts to share the same state, you'll need to elevate your provider wrapper to a common parent of both!
Haleem Hosein liked a comment+100 XP
4mos ago
Hi, I really enjoyed this course, thank you!
If you're using the latest version of the Starter Kit with Wayfinder, I like this way of handling forms. We avoid using useForm, specify the PUT method, and the images are handled automatically. Just import Form from Inertia and PuppyController from actions.
<Form
{...PuppyController.update.form.put(puppy)}
options={{
preserveScroll: true,
}}
onSuccess={() => setOpen(false)}
className="space-y-6"
>
{({ processing, errors }) => (
<>
<Label htmlFor="name">Name</Label>
<Input
id="name"
name="name"
className="mt-1 block w-full"
defaultValue={puppy.name}
required
autoComplete="name"
placeholder="Full name"
/>
{errors.name && (
<p className="mt-1 text-xs text-red-500">
{errors.name}
</p>
)}
<Label htmlFor="trait">Personality trait</Label>
<Input
id="trait"
name="trait"
className="mt-1 block w-full"
defaultValue={puppy.trait}
required
placeholder="Personality trait"
/>
{errors.trait && (
<p className="mt-1 text-xs text-red-500">
{errors.trait}
</p>
)}
<Label htmlFor="image">Change image</Label>
<Input
id="image"
name="image"
type="file"
className="mt-1 block w-full"
placeholder="Profile picture"
/>
{errors.image && (
<p className="mt-1 text-xs text-red-500">
{errors.image}
</p>
)}
<DialogFooter className="gap-2">
<DialogClose asChild>
<Button variant="secondary">Cancel</Button>
</DialogClose>
<Button
className="relative disabled:opacity-100"
disabled={processing}
type="submit"
>
{processing && (
<div className="absolute inset-0 grid place-items-center">
<LoaderCircle className="size-5 animate-spin stroke-primary-foreground" />
</div>
)}
<span
className={clsx(
processing && 'invisible',
)}
>
Update
</span>
</Button>
</DialogFooter>
</>
)}
</Form>