1 回答

TA貢獻(xiàn)1893條經(jīng)驗(yàn) 獲得超10個(gè)贊
在開(kāi)始之前,我假設(shè)你了解laravel Eloquent
假設(shè)您的lead_master 表是LeadMaster Model,也是MeetingsMasterandOpportunityMaster
$lead_master = LeadMaster::select("lead_master.lead_stage as stage")
? ? ->join('user_master','user_master.user_name','=','lead_master.assigned_user_name')
? ? ->whereIn('region',$geo) //$geo is an array
? ? ->whereIn('teams',$filter_username) //also an array
? ? ->groupBy('lead_stage');
$meetings_master = MeetingsMaster::select('meeting_hash as stage')
? ? ->whereIn('assigned_user_name',$filter_username)
? ? ->whereIn('meeting_hash',['follow_up','first_time'])
? ? ->groupBy('meeting_hash');
$opportunity_master = OpportunityMaster::select('sales_stage as stage')
? ? ->whereIn('sales_stage',['Identified','QO_to be approved'])
? ? ->whereIn('assigned_user',filter_username)
? ? ->groupBy('sales_stage');
$query = $lead_master->union($meetings_master)->union($opportunity_master)->pluck('stage'); //your result
dd($query);
這就是你使用Laravel Eloquent時(shí)的樣子
ps:你不需要為此制作3個(gè)變量,我只是用它來(lái)方便維護(hù)
- 1 回答
- 0 關(guān)注
- 137 瀏覽
添加回答
舉報(bào)