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.
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 emptyModel
instance, as opposed tonull
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.