1 回答
TA贡献1893条经验 获得超10个赞
在开始之前,我假设你了解laravel Eloquent
假设您的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时的样子
ps:你不需要为此制作3个变量,我只是用它来方便维护
- 1 回答
- 0 关注
- 107 浏览
添加回答
举报