cunlayogd

Experience

120

0 Best Reply Awards

  • Member Since 2 Months Ago
  • 0 Lessons Completed
  • 0 Favorites

2nd August, 2018

cunlayogd left a reply on Get Combination Of Numbers In An Array Equal To The Sum Of A Given Number • 2 weeks ago

I tried the following,

$points = CampaignView::where('viewer_id', $request->id)->where('is_point_redeemed', 0)->get();

        $sum = 0;
        return $points->filter(function($commission) use(&$sum) {
            $sum += $commission->point_gained;
            return $sum <= 100;
        });
            

This returns a wrong result.

cunlayogd started a new conversation Get Combination Of Numbers In An Array Equal To The Sum Of A Given Number • 2 weeks ago

Hi guys, I am trying to get the perfect combination of numbers in an array that will be equal to the sum of a given number.

14th June, 2018

cunlayogd left a reply on Eloquent Merge Two Queries • 2 months ago

@mballaag thank you, I have formatted the code

cunlayogd left a reply on Count Distinct Column In A Relationship • 2 months ago

Thanks @mballaag I formatted the codes already

cunlayogd started a new conversation Filtering Multiple Relationships • 2 months ago

Hi guys, I have a jobPost model that has a relationship with JobLocation model. How can I get count of distinct locations in my jobPost table using eloquent.

This works

$jobLocations = DB::table('job_post_locations') ->join('locations', 'job_post_locations.location_id', '=', 'locations.id') ->select('locations.id','locations.name',DB::raw('count(*) as location_count')) ->groupBy('location_id') ->get();

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.