Haleem Hosein's avatar

Haleem Hosein liked a comment+100 XP

1mo ago

Repeater\TableColumn::make('Title')->markAsRequired() instead of adding * manually

Haleem Hosein's avatar

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's avatar

Haleem Hosein liked a comment+100 XP

1mo ago

I’m looking forward to the rest of this series just to see what you do while Claude is working 😂

Haleem Hosein's avatar

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's avatar

Haleem Hosein liked a comment+100 XP

2mos ago

For verifying that the request status exists in the IdeaStatus enum, PHP has a nice built in method that Claude Code showed me:

$status = IdeaStatus::tryFrom($request->status ?? '');

It will return the value if it exists or null otherwise.

Haleem Hosein's avatar

Haleem Hosein liked a comment+100 XP

2mos ago

As much as I like to practice array mapping and manipulation, countBy() helps to clean the logic up a bit:

// Get counts in the controller
'counts' => $request->user()->ideas()->get()->countBy('status');

// Get counts in view, including those with no records
{{ $counts[$ideaStatus->value] ?? 0 }}
Haleem Hosein's avatar

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's avatar

Haleem Hosein liked a comment+100 XP

2mos ago

Love the way you structure your lessons. Speedrun some bits, explain each step of the way. Really good stuff!

Oh and I am 100% guilty of doing the "it didn't work, try again" and adding layers of slop to my vibes 🤣

Taking good notes!

Haleem Hosein's avatar

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's avatar

Haleem Hosein liked a comment+100 XP

3mos ago

Amazing feature! Thanks Caleb ❤️

Haleem Hosein's avatar

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's avatar

Haleem Hosein liked a comment+100 XP

4mos ago

Can there only be one of <LinkedContext ...></LinkedContext> or can I have two, one that wraps the <Shortlist ...> and one that wraps the <PuppiesList ...> in case <Search /> is expensive to render? And if yes, then do they share the context or is it a new one for each?

Haleem Hosein's avatar

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's avatar

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.