Courses

Laravel 11 Eloquent: Expert Level

find(), all(), first() and Their Extra Options

Summary of this lesson:
- Understanding different all() and find() method variations
- Using firstOrFail() and firstOr() methods
- Working with specific field selections
- Handling model not found scenarios

Let's talk about all() and first() methods of Eloquent. They have different parameters and kinds of advanced features.


So typically, if we launch all(), for example, from Tinker, it returns all the models.

In this case, there are three users in the database. Did you know you can specify the fields? The all() method accepts...

The full lesson is only for Premium Members.
Want to access all 28 lessons of this course? (71 min read)

You also get:

  • 69 courses (majority in latest Laravel 11)
  • Premium tutorials
  • Access to repositories
  • Private Discord