Courses

Laravel 12 Eloquent: Expert Level

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

You're reading a FREE PREVIEW of a PREMIUM course.
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

Video Version of the Lesson

[Only for premium members]

Link to the repository

[Only for premium members]

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 38 video+text lessons of this course? (1 h 34 min)

You also get:

  • 77 courses
  • Premium tutorials
  • Access to repositories
  • Private Discord