Skip to main content

All Tutorials

In-depth Laravel tutorials covering advanced topics, real-world examples, and best practices.

Tutorial Free

Stop checking if record exists: Eloquent methods OrCreate and OrNew

Another "hidden gem" of Laravel which is surprisingly rarely used or even known, though it's mentioned in the official Eloquent documentation. Imagine that you have a record, and you need to check if that record already exists in the database - to prevent duplicate, you wouldn't save it second time. There's an elegant way to perform it in Eloquent.

Tutorial Free

Eloquent Relations: how to order topics by newest posts?

Quite a typical scenario, but not easy to find the answer. You can easily order Eloquent results by some column, but what if you want to order by related column in child table? Most common example is a forum like Laracasts which shows topics in order by the latest post in that topic. How to do that?

Tutorial Free

Laravel simplePaginate: more effective with bigger data

Laravel pagination is quite a simple thing to use, but to determine the amount of pages it makes additional query to the database, which may be a problem for bigger amount of data. And you can actually avoid it.

Tutorial Free

Laravel Models folder: To Be or Not To Be

This post is inspired by some discussions that appear constantly in various forums or social media channels. Question of the day/month/year: why is there no app/Models folder? And do we need one?

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.