From Larave 5 and up you need "use" every class, including models by their namespace.
....
use Models/Follow;
class User {
....
....
public function follow() {
return $this->hasMany('Follow');
}
}
you can also define return $this->hasMany('Follow');
as return $this->hasMany(Follow::class);
astroanu said:
From Larave 5 and up you need "use" every class, including models by their namespace.
.... use Models/Follow; class User { .... .... public function follow() { return $this->hasMany('Follow'); } }
you can also define
return $this->hasMany('Follow');
asreturn $this->hasMany(Follow::class);
Class 'Models\Follow' not found it still can't see the class. Shown path is right, but stil..
Okay, solution was as @astroanu said. Every class what User model used, I added like:
use Events\Models\Follow;
and method to return:
public function follow() {
return $this->hasMany(Follow::class);
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community