public function getConfiguracion($idGroups = null, $idCustomer = null) { $dataGroups = Groups::find($idGroups); if ($dataGroups->customer_id == 0) { $typeCampania = Campania::where('flagactive', '=', '1')->whereCustomerId(null)->lists('name', 'id'); } else { if ($idCustomer == null) { $idCustomer = Auth::customer()->user()->id; } $typeCampania = Campania::where('flagactive', '=', '1')->whereCustomerId($idCustomer)->lists('name', 'id'); // $typeCampania = [null => 'Por favor seleccione una opción'] + $typeCampania; } $dataCampania = Campania::whereCustomerId($idCustomer)->get()->toArray(); $datos = GroupsCampania::join('campania as c', 'c.id', '=', 'group_campania.campania_id')->select('group_campania.day_id')->where('group_campania.groups_id', '=', $idGroups)->get()->toArray(); foreach ($datos as $value) { $days[] = $value['day_id']; } $day = Day::all(); foreach ($day as $d) { $checked = isset($days) ? in_array($d->id, $days) : false; if ($checked) { $datos = GroupsCampania::join('campania as c', 'c.id', '=', 'group_campania.campania_id')->select('c.*', 'group_campania.*')->where('group_campania.groups_id', '=', $idGroups)->where('group_campania.day_id', '=', $d->id)->first(); $d->campania_id = $datos->campania_id; $d->campania_name = $datos->name; $d->campania_imagen = $datos->imagen; } } return viewc('client.' . self::NAMEC . '.configuracion', compact('idGroups', ['table', 'dataCampania', 'day']), ['typeCampania' => $typeCampania]); }
public function getConfiguracion($idEquipment = null, $idCustomer = null) { $dataHotspots = Hostpots::find($idEquipment); if ($idCustomer == null) { $idCustomer = Auth::customer()->user()->id; } $dataCampania = Campania::whereCustomerId($idCustomer)->get()->toArray(); if ($dataHotspots->geocode == 0) { $typeCampania = Campania::where('flagactive', '=', '1')->whereCustomerId(null)->lists('name', 'id'); } else { if ($idCustomer == null) { $idCustomer = Auth::customer()->user()->id; } $typeCampania = Campania::where('flagactive', '=', '1')->whereCustomerId($idCustomer)->lists('name', 'id'); } $datos = HotspotsCampania::join('campania as c', 'c.id', '=', 'hotspots_campania.campania_id')->select('hotspots_campania.day_id')->where('hotspots_campania.hotspots_id', '=', $idEquipment)->get()->toArray(); foreach ($datos as $value) { $days[] = $value['day_id']; } $day = Day::all(); foreach ($day as $d) { $checked = isset($days) ? in_array($d->id, $days) : false; if ($checked) { $datos = HotspotsCampania::join('campania as c', 'c.id', '=', 'hotspots_campania.campania_id')->select('c.*', 'hotspots_campania.*')->where('hotspots_campania.hotspots_id', '=', $idEquipment)->where('hotspots_campania.day_id', '=', $d->id)->first(); $d->campania_id = $datos->campania_id; $d->campania_name = $datos->name; $d->campania_imagen = $datos->imagen; } } return viewc('client.' . self::NAMEC . '.configuracion', compact('idEquipment', ['datos', 'dataCampania', 'day', 'idCustomer']), ['typeCampania' => $typeCampania]); }