Laravel 8.35, weekly updates, and 🔥 tip
Laravel 8.35
A couple fixes this week and a few new features. So we bump to 8.35.0. Here are the highlights:
- Fix missing
lazy
andlazyById
onBelongsToMany
andHasManyThrough
relationships in #36758 - Fix qualified column names in pivot query in #36720
- Deprecate
MocksApplicationServices
trait in #36716 - Make
ResponseSequence
macroable in #36719 - Allow lazy collection to be instantiated from a generator in #36738
And for those fired up about Octane there was a descriptionless PR titled Octane Prep.
You may review the full branch diff on GitHub for a complete list of changes.
This minor version bump and update is automated for subscribers to a Shifty Plan. If you don't have one of those, be sure to bump your constraint and run composer update
to get the latest features.
Weekly Journal
Last week I finished up some more Human Shifts. One was all the way back from Laravel 4.2. Another was from the latest LTS version to Laravel 8.
I also received some additional feedback on the Tailwind Shifts. Particularly the Tailwind Converter, which was recently updated for Tailwind 2.x.
I'm pushing those patches today. I expect these will be out of beta in the next few weeks. So if you want to save a few bucks, now is the time to give them a try.
I also quietly released a Tailwind Linter. For now this simply optimizes your Tailwind configuration file. In the future, it will also do some analysis on overlapping inline utilities and opportunities to extract common sets of utilities.
This week I am focusing on my end of the month refactoring. Pairing with Jess helped me identify areas where I've lived with some pain. Now with someone else in the codebase it's time to clean it up.
I also worked on a "mid-cycle" Laravel 8 Shift. There has been a growing number of changes to the core files since the last release. This has always been the case, but since Laravel has moved to annual release cycles they have reached a critical mass.
Of course I constantly update the Laravel 8.x Shift to reflect these changes. Yet those who have already upgraded may have a few stale files. So subscribers to a Shifty Plan will automatically receive a "Laravel 8 Updates Shift" over the next few days.
🔥 Tip
I love streamlining my code. This aligns with the practices I talk about in BaseLaravel. One of the snippets I find myself constantly streamlining are Eloquent queries.
I often do so with query scopes. But when updating the Shift dashboard to always show your next pending Shift at the top, I remembered you may also pass these methods custom arguments.
In this case, I wanted to now exclude pending Shifts from the query. So I opted to add an exclusion parameter.
1$orders = Order::where('user_id', $request->user()->id)2 ->purchased(Order::STATUS_PENDING)3 ->orderByDesc('updated_at')4 ->take(5)5 ->get();
While I like to keep query scopes without any arguments, this was something I actually needed in another part of the code. So the additional argument allowed me to streamline more code elsewhere.