How to Specify the Attributes to be Returned in the Laravel Find Method
In this lesson, we will see how to specify the attributes to be returned in the Laravel find method, sometimes when working with the find method you want to return only some attributes instead of all.
How to return only some attributes instead of all
Let's assume that we want to retrieve only the name and the email of a given user.
User::find(1, ['name', 'email'])->first();