Answers for "call to a member function addeagerconstraints() on null in file e:\q"

PHP
2

Error: Call to a member function addEagerConstraints() on null in file

in your relationship you are missing return statement, 
please follow the following example

public function user() {
        $this->belongsTo(User::class,'user_id','id');
}

to 
  
public function user() {
        return $this->belongsTo(User::class,'user_id','id');
    }
Posted by: Guest on January-04-2022

Code answers related to "call to a member function addeagerconstraints() on null in file e:\q"

Browse Popular Code Answers by Language