I have an account model. I define & save it following way:
$account = new Account();
$account->email = $request->get('email');
$account->name = $request->get('name');
$account->save();
dd($account->id) // null
Why account id is not updated? I use autoincremental id field. I see record in the database.
You should set your primary key on your model.
Try to insert this on your model:
protected $primaryKey = "id";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With