Skip to main content
deleted 2 characters in body
Source Link
Lupinity Labs
  • 2.5k
  • 1
  • 20
  • 28

You can try adding a ->loadCount() after your load call. Unfortunately, Laravel doesn't support dot notation at that point due to complexity, so ->loadCount('coupons.userCoupons') will not work.

You can add a HasManyThrough relationship on your Offer model, however, for instance

 public function UserCoupons(): HasManyThrough { return $this->hasManyThrough(UserCouponsUserCoupon::class, CouponsCoupon::class); } 

You can then just do a $offer->loadCount('UserCoupons').

You can try adding a ->loadCount() after your load call. Unfortunately, Laravel doesn't support dot notation at that point due to complexity, so ->loadCount('coupons.userCoupons') will not work.

You can add a HasManyThrough relationship on your Offer model, however, for instance

 public function UserCoupons(): HasManyThrough { return $this->hasManyThrough(UserCoupons::class, Coupons::class); } 

You can then just do a $offer->loadCount('UserCoupons').

You can try adding a ->loadCount() after your load call. Unfortunately, Laravel doesn't support dot notation at that point due to complexity, so ->loadCount('coupons.userCoupons') will not work.

You can add a HasManyThrough relationship on your Offer model, however, for instance

 public function UserCoupons(): HasManyThrough { return $this->hasManyThrough(UserCoupon::class, Coupon::class); } 

You can then just do a $offer->loadCount('UserCoupons').

added 423 characters in body
Source Link
Lupinity Labs
  • 2.5k
  • 1
  • 20
  • 28

You can try adding a ->loadCount('coupons.userCoupons') after your load call. Unfortunately, Laravel doesn't support dot notation at that point due to complexity, so ->loadCount('coupons.userCoupons') will not work.

You can add a HasManyThrough relationship on your Offer model, however, for instance

 public function UserCoupons(): HasManyThrough { return $this->hasManyThrough(UserCoupons::class, Coupons::class); } 

You can then just do a $offer->loadCount('UserCoupons').

You can try adding a ->loadCount('coupons.userCoupons') after your load call.

You can try adding a ->loadCount() after your load call. Unfortunately, Laravel doesn't support dot notation at that point due to complexity, so ->loadCount('coupons.userCoupons') will not work.

You can add a HasManyThrough relationship on your Offer model, however, for instance

 public function UserCoupons(): HasManyThrough { return $this->hasManyThrough(UserCoupons::class, Coupons::class); } 

You can then just do a $offer->loadCount('UserCoupons').

Source Link
Lupinity Labs
  • 2.5k
  • 1
  • 20
  • 28

You can try adding a ->loadCount('coupons.userCoupons') after your load call.