intermediateLaravel
Previous
What is the difference between find(), first(), firstOrFail(), and findOrFail()?
Next
What are soft deletes?
What is the difference between get(), first(), value(), and pluck()?
Answer
Clear, interview-ready explanation
get() executes a query and returns an Eloquent collection of all matching models. first() returns only the first matching model or null. Use them when the caller needs complete model objects and their model behavior or relationships.
value('column') returns the value of one column from the first matching row, or null. pluck('column') returns a collection containing that column’s values from all matching rows and may use a second column as keys. value and pluck are more efficient and expressive when full models are unnecessary.