whereHas('incentiveCategory', fn ($query) => $query->where('name', 'ASIN Rating Bonus')) ->first(); if (!$incentive || ($incentive && $incentive->amount_value_earned === 0)) return; StudioPlusVideo::query() ->with( [ 'channel.user' ] ) ->whereIn('status', [ StudioPlusVideo::STATUS_APPROVED, StudioPlusVideo::STATUS_AMAZON_UPLOADED, StudioPlusVideo::STATUS_AMAZON_APPROVED, StudioPlusVideo::STATUS_PUBLISHED_TO_AMAZON, ]) ->thisMonth() ->where('amazon_total_reviews', '>', $incentive->target_rule) ->each(function ($video) use ($incentive) { $this->addIncentiveItemForVideo($video->channel->user, $video, $incentive, 'Rating Incentive Bonus'); }); } }