Laravel 5.4 field doesn't have a default value

Remove the guarded array and add the fillable instead:

protected $fillable = ['user_id', 'deal_id'];

If you would like to revert to previous behavior, update your

config/database.php

file and set 'strict' => false for your connection.


Since it was a unique field in my case, I could not make it nullable.

For me, I had an empty constructor which was causing the issue don't know why. Please comment if anyone knows the reason.

public function __construct(){

}

Commenting/removing it resolved the issue.