codeplumber liked a comment+100 XP
3mos ago
@isimmons We could also have the alpine's @click.away="$dispatch('search:clear-results')"
codeplumber liked a comment+100 XP
3mos ago
@codeplumber, I agree that it reads better, but be aware of potential performance issues down the line.
Doing a GROUP BY like in the video delegates counting to the DB. This is something that DBs do all the time and is already fairly optimized. In this case, PHP receives already prepared counts for each of the categories.
Doing an ideas()->get()->countBy('status') will:
- Select rows from the database;
- Pass all of these rows from the DB to PHP;
- Load them as Eloquent models (the reason we have all of these different helper methods available); and
- Iterate over all of these Eloquent objects to get the count.
This is fine for a tutorial project, but it won't scale well down the line. While it would take 1000s of records to notice any real difference, I'd still suggest using the first approach. It's better to be safe than sorry.
codeplumber wrote a comment+100 XP
5mos ago
Just finished this series and I must say that despite I did not expect to learn much new stuff, I am left with multiple pages of what I expected to be almost empty markdown note. Thanks Jeffrey and good luck to everyone learning at Laracasts!
codeplumber wrote a comment+100 XP
5mos ago
@JeffreyWay You set the expectations too high for the rest of us, fixing bugs that fast! Thanks Jeffrey
codeplumber liked a comment+100 XP
5mos ago
It looks like the video cuts off too early (length of video is around 2mins). But the episode summary does show the completion of extraction of the modal.
codeplumber wrote a comment+100 XP
5mos ago
@mrrobotoh I have submitted a support ticket as it seems the issue is still here.
codeplumber wrote a comment+100 XP
5mos 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 }}
codeplumber wrote a comment+100 XP
6mos ago
Color theme for those looking to copy:
--color-background: oklch(0.12 0 0);
--color-foreground: oklch(0.95 0 0);
--color-card: oklch(0.16 0 0);
--color-primary: oklch(0.65 0.15 160);
--color-primary-foreground: oklch(0.12 0 0);
--color-border: oklch(0.24 0 0);
--color-input: oklch(0.24 0 0);
--color-muted-foreground: oklch(0.6 0 0);