There are two models. User (resulting from make: auth ) and Ad . The Ad model inherits the Model , and the User model inherits the Authenticatable .
As a result, when I try to assign relationships between models, I get the error:
General error: 1364 Field 'user_id' doesn't have a default value
Ad model has the function:
public function user() { return $this->belongsTo('App\User'); } The User model has the function:
public function ads() { return $this->hasMany('App\Ad'); } What is the problem and how to solve?