Laravel Eloquent: 8 Tools to Debug Slow SQL Queries
In Laravel and Eloquent, to avoid N+1 Query problems or to find slow SQL queries, you may use automatic tools. In this short tutorial, I will show you a few of them.
In-depth Laravel tutorials covering advanced topics, real-world examples, and best practices.
In Laravel and Eloquent, to avoid N+1 Query problems or to find slow SQL queries, you may use automatic tools. In this short tutorial, I will show you a few of them.
The term "multi-tenancy" has different meanings and implementations in Laravel. In this article, let's take a look at a multi-database approach, using the package stancl/tenancy: I will show you step-by-step, how to make it work.
When using Route Model Binding in Laravel, it's important to have the same name of the parameter in the routes file and in the method variable name.
If you have a query with the `belongsTo` relationship and want to order the records by the column from that related table, the orderBy wouldn't work.
If you have two tables with a `hasOne` or `hasMany` relationship between them, and you want to query a row that is missing from the second table, you can use `doesntHave()` in Eloquent.
Some Laravel tasks are running in the background and you need to check whether they are finished. But what if you didn't need to constantly check, but rather "listen" for those events to finish? Let's implement exactly this real-time feedback, with Soketi server.
If you have a few similar GET routes, there's a danger of one overriding another.
Collections in Laravel are "hidden gems": not everyone is using them. They are especially effective when performing MULTIPLE operations with data - so-called "chains". I've gathered 15 real-life examples from open-source Laravel projects. The goal is not only to show the Collection methods but also the practical scenarios of WHEN to use them.
If you have 10 rows of data in the initial Seeder file, but then you need to import 10 more rows when the project is already launched, what should you do? There are a few options.
Let's say you have a Login page with the language prefix in URL: `/en/login` and `/fr/login`. To show French/English texts on the Login page, you need to do these things.