💡Dealing with statuses and states can be a real headache in larger applications. You can use the state pattern together with transitions and enums.
Some benefits:
- Encapsulation
- SRP
- Small, easy-to-understand classes
🧵Keep Reading
This week's Laravel release has some 🔥
First, automatic Eloquent API resource discovery. As long as your resource follows typical Laravel naming conventions and is in the Http\Resources namespace closest to your model, Laravel will find it.
https://t.co/Ll1gM0fvaA
We will be releasing Laravel 12 on Monday.
This is primarily a maintenance focused release that updates upstream dependencies and has minimal breaking changes or major few features.
Because of that, the vast majority of applications will be able to upgrade with no changes to your application's code. 🚀
As more and more applications are built with Laravel, we're focusing on shipping new features continually throughout the year without breaking changes, with our yearly releases being utilized to update dependencies or address new PHP version compatibility.
The main focus next week will be:
- Laravel Cloud
- New Laravel Starter Kits
- New Laravel Website
- Laravel VS Code Extension's Stable Release
It's going to be an amazing week for Laravel and PHP. 🤘
Okay...this is insane 🤯
I got @inertiajs running in combination with React Native
Laravel on iOS
Communicating with InertiaJS
Rendering native UI elements
😎
If you're executing something computationally heavy that may be called multiple times in the same request, consider caching the result using Laravel's "once" helper added in 11.x
This will create an in-memory cache of the result tied to the current process and outer object (in this case, the user)
On subsequent calls during the same request lifecycle, the initial result will be returned, saving you computing the result again
In Inertia 2.0, we now have access to laughably easy-to-implement polling.
Need to refresh a piece of data every few seconds without requiring a manual page reload? Simple! 👇
Good nugget from Shape Up by @basecamp.
Build the "novel" part of software first. Don't start with a login screen or something you've built many times before.
By starting with what is novel you quickly remove uncertainty, and it's also where you're most likely to fail — this is a good thing!
If you're going to encounter a huge obstacle, better to encounter it very quickly before you've wasted a lot of time on other boilerplate.
💡When I need to work with date filters I often add a simple DateFilter class with static factory functions.
It's a very simple yet clean solution. Maybe you can also use it in your project.
👇Example usage below
💡 If you're running PHP or Laravel apps in production you're probably using nginx and php-fpm.
But do you actually know what these terms mean?
- CGI
- FastCGI
- php-fpm
- How do they connect to nginx?
Let's find out!
🧵 Keep Reading
🔥Level up your Eloquent game
In this thread, you can read about 5 pretty useful but not so well-known Eloquent features such as:
- whereBelongsTo
- whereRelation
- Default relationship values
🧵Keep Reading
🔥🔥🔥 FrankenPHP 1.3 has just been released: this version is 54% (!!) more efficient than the previous one and contains a bunch of new features and fixes, including file watchers support and new Prometheus metrics.
Read the announcement: https://t.co/Lz8X4u9VJB
🔥 Laravel Tip
Apps can sometimes become littered with "retry" calls in an effort to prevent deadlocks. To avoid this, drop down to the DB connection itself and add the "retry" to the "run" method. You can also conditionally retry only when encountering a deadlock / concurrency