public function getAssign($adv_id) { if (Auth::check()) { if (User::isSuperAdmin()) { $adver_obj = Advertiser::with('Creative', 'GeoSegment', 'BWList')->find($adv_id); } else { $usr_company = $this->user_company(); $adver_obj = Advertiser::whereHas('GetClientID', function ($p) use($usr_company) { $p->whereIn('user_id', $usr_company); })->with('Creative', 'GeoSegment', 'BWList')->find($adv_id); if (!$adver_obj) { return Redirect::back()->withErrors(['success' => false, 'msg' => 'please Select your Client'])->withInput(); } } if ($adver_obj) { $geolocation_obj = Geolocation::get(); return view('bulk.assign')->with('geolocation_obj', $geolocation_obj)->with('adver_obj', $adver_obj); } } }