Using Laravel's new Query Builder Upsert feature
– atymic.dev - submitted by atymic
Overview of the new upsert feature in Laravel 8.10, how to use it and some tips.
Read more [atymic.dev]
– atymic.dev - submitted by atymic
Overview of the new upsert feature in Laravel 8.10, how to use it and some tips.
Read more [atymic.dev]
– timacdonald.me - submitted by Tim Mac
Here's how to handle moving from a classic foreign key constrained relationship, to a polymorphic relationship in Eloquent, without impacting the end user.
Read more [timacdonald.me]
Join 9,500+ smart developers
Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.
No spam. Unsubscribe anytime. You can also follow me on X.
"As a Laravel developer, this is the one newsletter I most look forward to. Freek has a talent for distilling packages or techniques down to something immediately useful - one tip can save you hours and even weeks. It's concise and practical and highly relevant."
When reviewing the contents of the database of Flare, we encountered a table with 1 billion records. Technically that isn't a problem. Flare runs on Vapor and uses an Aurora database, so it can handle that scale. But of course, there's a cost for storing that many records.
We dove in and concluded that we could safely delete about 900 million records. They all were created before a specific date.
Read more [flareapp.io]
– fidum.uk
Dan Manson explains how you can run that shiny new schema:dump command on GitHub actions. Pretty cool
Read more [fidum.uk]
Databases are the backbone of most modern systems, so taking some time to understand how they work is a good investment for any developer.
Read more [hakibenita.com]
Matthias Noback shares his thoughts on when you should and when you shouldn't rely on the database to perform certain tasks
Read more [matthiasnoback.nl]
Using our laravel-model-cleanup package, you can easily remove old unneeded records from your database. We recently released a new major version that adds support for safely cleaning out huge tables.
In this blog post, I'd like to introduce this new release of the package to you.
Jonathan Reinink published another excellent blogpost on db performance.
Read more [reinink.ca]
– medium.com - submitted by Pavol Perdik
In this article Pavol Perdik writes about the native PostgreSQL type daterange and how to easily use it in Laravel.
Read more [medium.com]
Laurie Voss, co-founder of npm, explains how databases work, what the difference is between MySQL and something like Redis, why MySQL is popular and much more!
My twitter-friend Simon had a simple question that contained much complexity: how do databases work? The result was an absurdly long thread of 70+ tweets, in which I expounded on the workings and history of databases as used by modern web developers, and Simon chimed in on each tweet with further questions and requests for clarification. The result of this collaboration was a super fun tiny explanation of databases which many people said they liked, so here it is, lightly edited for clarity.
Read more [seldo.com]
sql tips: you can group by anything pic.twitter.com/YoJVlUyghG
— ?Julia Evans? (@b0rk) 29 september 2019
Read more [twitter.com]
CASE is SQLs answer to other programming languages IF-ELSE statement. If you need to test a condition and return a value CASE is the expression you need.
Read more [www.helenanderson.co.nz]
And if you're a @laravelphp user wondering how you can use this feature, you can easily extend the query builder to support this. ?
— Jonathan Reinink (@reinink) July 16, 2019
Gist here: https://t.co/Wuavz0v7p9 pic.twitter.com/Vy6NJdJbcx
Read more [twitter.com]
Jonathan Reinink wrote another awesome post on how to handle a complicated query.
I was asked recently how to calculate multiple totals (aggregates) in Laravel in the most efficient way. For example, maybe you have an email subscription service and want to display various totals based on your subscribers
Read more [reinink.ca]
Povilas Korop explains how to use a raw groupBy in Laravel. Cool!
Read more [laraveldaily.com]
Here's a neat trick for soft deleting relationships in @laravelphp. ?
— Jonathan Reinink (@reinink) February 27, 2019
When you delete a record, immediately also soft delete any child records. ?
Later, when you restore the parent, automatically also restore all child records that were deleted when the parent was deleted. ? pic.twitter.com/YsYKWtu00R
Read more [twitter.com]
Over at the Honeybadger blog, Starr Horne wrote an interesting article on the different types of UUIDs and ULIDs.
UUIDs are and will continue to be the standard. They've been around forever, and libraries are available in every language imaginable. However, new approaches are worth considering, especially as we enter a world that's increasingly run by distributed systems. New unique-id approaches may help us solve problems that weren't prevalent at the publication of RFC4122.
Read more [blog.honeybadger.io]
⚠️ Make sure to always use the right types when querying (Eloquent version) ⚠️#laravel #php #mysql #castingisfun pic.twitter.com/TMnjYbuoCe
— Freek Van der Herten (@freekmurze) February 10, 2019
Read more [twitter.com]
Mohammed Said shows a great way on how to handle db connections in a multi tenancy Laravel app.
The majority of applications just communicate with a single database. However, a considerable portion of laravel applications communicates with multiple databases. There are some neat packages that help with managing multiple connections, but it'd be useful if we understand how database connections work in Laravel, so let's dive in.
Read more [divinglaravel.com]
Jonathan Reininck wrote a cool article on how you can create dynamic releationships. This technique will keep the number of queries and the memory used to a minimum.
I hope that gives you a good overview of how you can use subqueries to create dynamic relationships in Laravel. This is a powerful technique that allows you to push more work into the database layer of your app. This can have a huge impact on performance by allowing you to drastically reduce the number of database queries executed and overall memory used.
Read more [reinink.ca]