I have two model Products and Photo. These models are followings
Photo Model
public function Product(){
return $this->belongsTo('App\Product');
}
Product Model
public function Photo(){
return $this->hasMany('App\Photo');
}
I need to get all the photos of a product catagory. For this i have tried this
$Photo = Products::Photo()->where(['catagory' => $request->catagory])->get();
But I'm getting the following error.
ErrorException in IndexController.php line 49: Non-static method App\Product::Photo() should not be called statically
How to solve it? And what is the problem