public function OfferEditView($clid, $advid, $ofrid)
 {
     if (!is_null($ofrid)) {
         if (Auth::check()) {
             if (in_array('ADD_EDIT_OFFER', $this->permission)) {
                 if (User::isSuperAdmin()) {
                     $offer_obj = Offer::with(['getAdvertiser' => function ($q) {
                         $q->with('GetClientID');
                     }])->find($ofrid);
                     $get_pixel = Pixel::get();
                 } else {
                     $usr_company = $this->user_company();
                     $offer_obj = Offer::whereHas('getAdvertiser', function ($q) use($usr_company) {
                         $q->whereHas('GetClientID', function ($p) use($usr_company) {
                             $p->whereIn('user_id', $usr_company);
                         });
                     })->find($ofrid);
                     $get_pixel = Pixel::whereHas('getAdvertiser', function ($q) use($usr_company) {
                         $q->whereHas('GetClientID', function ($p) use($usr_company) {
                             $p->whereIn('user_id', $usr_company);
                         });
                     })->get();
                 }
                 if (!$offer_obj) {
                     return Redirect::back()->withErrors(['success' => false, 'msg' => 'please Select your Client'])->withInput();
                 }
                 $offer_pixel = Offer_Pixel_Map::where('offer_id', $ofrid)->get();
                 $offer_pixel1 = array();
                 if (count($offer_pixel) > 0) {
                     foreach ($offer_pixel as $index) {
                         array_push($offer_pixel1, $index->pixel_id);
                     }
                 }
                 //                        return dd($offer_pixel1);
                 return view('offer.edit')->with('pixel_obj', $get_pixel)->with('offer_pixel', $offer_pixel1)->with('offer_obj', $offer_obj);
             }
             return Redirect::back()->withErrors(['success' => false, 'msg' => "You don't have permission"]);
         }
         return Redirect::to(url('/user/login'));
     }
 }
 public function ChangeStatus($id)
 {
     if (Auth::check()) {
         if (in_array('ADD_EDIT_PIXEL', $this->permission)) {
             if (User::isSuperAdmin()) {
                 $entity = Pixel::find($id);
             } else {
                 $usr_company = $this->user_company();
                 $entity = Pixel::whereHas('getAdvertiser', function ($q) use($usr_company) {
                     $q->whereHas('GetClientID', function ($p) use($usr_company) {
                         $p->whereIn('user_id', $usr_company);
                     });
                 })->find($id);
                 if (!$entity) {
                     return 'please Select your Client';
                 }
             }
             if ($entity) {
                 $data = array();
                 $audit = new AuditsController();
                 if ($entity->status == 'Active') {
                     array_push($data, 'status');
                     array_push($data, $entity->status);
                     array_push($data, 'Inactive');
                     $entity->status = 'Inactive';
                     $msg = 'disable';
                 } elseif ($entity->status == 'Inactive') {
                     array_push($data, 'status');
                     array_push($data, $entity->status);
                     array_push($data, 'Active');
                     $entity->status = 'Active';
                     $msg = 'actived';
                 }
                 $audit->store('pixel', $id, $data, 'edit');
                 $entity->save();
                 return $msg;
             }
         }
         return "You don't have permission";
     }
     return Redirect::to(url('user/login'));
 }