laravel model find return null for existing id

Waseem posted 7 months ago

I am facing this issues of model find for existing id that is returning null and showing below error.

Creating default object from empty value

This id is exist in database butt still it return null.

$model = Shoppinglist::find($id); $model->buy_it = 1; $model->qty= $qty; $model->save();

This problem starts when i change the columns qty type from into(10) to float because i wan to save floating values in db column. I have spend hours on this issue and still unable to solve. I have check by providing static id value in-place of variable $id. I have check by converting $id to int.

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us