Using global query scopes for simple one-to-many tenancy.
Code example of a #Laravel cat pension #SaaS app I've started and never finished. It's structured like this:
A user belongs to a pension
A pension has many clients
A client has many animals
Users (cat pension owners and their employees) can only view clients and animals from the same pension. Global query scopes ensure this rule is consistently applied throughout the app without accidentally forgetting it somewhere in your code.
When developing #Laravel applications I'm always a little afraid of sending emails to actual customers or placing real orders by accident. So I came up with a habit that works super well for me and maybe this will suit you as well.
In my /config/mail.php I add a 'developer' email address and ensure in my AppServiceProvider all emails are sent to this address when in non-production environments no matter what. Makes me build and test stuff way more confidently 😁
It will replace the receiver and will optional add all the original receivers (to, cc, bcc) to the content of the email. That makes it useful for an acceptance environment to verify who would normally receive the email.
#PHP 8.4 is introducing newing up a class and accessing methods, properties, etc. on it without wrapping it in parentheses first. Another useful feature I will probably use on a daily basis. In my daily work with #Laravel I often need to crawl some content from a website or an API. This feature will make my code a little less cluttered.
Please, web app developers, consider how your users will upgrade. If your upgrade process is "remove the old one, unzip the new one", then it's not an upgrade process. It's an encouragement to never upgrade.
Does anybody on the fedi Laravel community knows Aaron Francis? It's really sad that his (awesome) fast-paginate package seems abandoned like this, maybe just a statement acknowledging he can't/doesn't want to maintain it anymore can make the community fork it to keep it maintained. This L11 support PR has been opened and unanswered for 2 months already.
It's great to see the #PHP ecosystem grow and prosper and I believe proper tool support and performance insights will only help when it comes to choosing the right tool for your job.
It's been a bit of a struggle getting everything to work for me, but thanks to our C specialists all the test scenarios I wrote along the way are now passing, including #Laravel#Octane
Today I collaborated with ondrey on a fix for #phpstan which improves a previous performance fix, which caused perf regressions in a #laravel edge-case.
The new fix allows a 2-3 seconds instead of 2-3 minutes analysis in all mentioned cases.
If you are using #Laravel#Herd and experiencing issues with Xdebug not recognizing the correct domain: Go to herd.conf and swap fastcgi_param SERVER_NAME $server_name; with fastcgi_param SERVER_NAME $host;
I’ve just spent quite way too much time scratching my head today thinking ‘I swear doing request()->route('param') used to get me the full model. Why is it only getting me a string now?!