Level 70
You can do relationships like this way.
firshtype.php
public function product(){
return hasMany('App\Fishtype');
}
product.php
public function check(){
return hasMany('App\Check');
}
Now, if you need to access any fishtype, you can try-
$fishtype = Fishtype::with('product', 'product.check')->where('id', 1)->first();
//printing product details that is associated with fishtype id 1
echo $fishtype->product->fishtype_id;
//printing check
echo $fishtype->product->check->product_id;
1 like