-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
When running Model::find($id) in a Laravel environment, and that the Model with the id $id doesn't exist, the return value is an empty Model instance, as opposed to null when calling a real Eloquent model that doesn't find a record in the database.
I've tried returning null, [], false in the Transport class when a model isn't found, but it is returning the empty model instance for all values.
I'm not sure if this is the expected behavior or not. I didn't appear to find a way of having null instead of the empty model when looking through the code.
dd(User::find(1));
---
App\Models\User {[#1639 ▼]()
#entity: "user"
#primaryKey: "id"
+exists: true
+wasRecentlyCreated: false
#attributes: []
#original: []
#changes: []
#casts: []
#appends: []
#dates: []
#dateFormat: "Y-m-d H:i:s"
#relations: []
#hidden: []
#visible: []
}Metadata
Metadata
Assignees
Labels
No labels