Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $second = DB::table('vendor_profiles')
- ->select('vendor_profiles.id')
- ->leftjoin('vendor_franchise', function ($join) {
- $join->on('vendor_profiles.id', '=', 'vendor_franchise.vendor_profile_id');
- })
- ->whereIn('vendor_franchise.franchise', $locations)
- ->where('vendor_profiles.status', 1)
- ->where('vendor_profiles.approved', 1);
- $first = DB::table('vendor_profiles')
- ->select('vendor_profiles.id')
- ->leftjoin('vendor_franchise', function ($join) {
- $join->on('vendor_profiles.id', '=', 'vendor_franchise.vendor_profile_id');
- })
- ->whereIn('vendor_profiles.state', $locations)
- ->where('vendor_profiles.status', 1)
- ->where('vendor_profiles.approved', 1)
- ->orderBy('vendor_profiles.updated_at', 'DESC')
- ->groupBy('vendor_profiles.id')
- ->union($second)
- ->pluck('id');
- return VendorProfiles::with('franchise')
- ->with('businessNature')
- ->with('promotions')
- ->with(['bookmark' => function ($query){
- if(Auth::user()){
- $query->where('user_id',Auth::user()->id);
- }
- }])
- ->with('reviews')
- ->withCount('reviews')
- ->whereIn('id', $first)
- ->orderBy('updated_at', 'DESC')
- ->get();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement