troubleshooting Question

Add more filters to Eloquent Laravel

Avatar of emi_sastra
emi_sastra asked on
PHPLaravel
2 Comments1 Solution20 ViewsLast Modified:
Hi All,

I have below code:


if($filters->has('Date') && $this->isAffectedBy($top ? 'top5partner' : 'bottom5partner', 'Date')){
            $from = new \Carbon\Carbon(date('Y-m-d', strtotime($filters['Date'][0])));
            $to = new \Carbon\Carbon(date('Y-m-d', strtotime($filters['Date'][1])));
        }

        $where = [
            ['Dimension', 'like', '%Final Score']
        ];

        $dt = \DB::table('datamaster')
            ->select(\DB::raw("Partner,
                AVG(DimensionScore) score"))    
            ->groupBy('Partner')
            ->where($where);

I want to add filter Month between $from and $to

How could I do it?

Thank you.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros