public function get($id = null) { $search = Input::get('search'); if (Auth::user()->profile_type == 'admin') { $users = User::withTrashed()->where(DB::raw('CONCAT(last_name," ",name)'), 'like', '%' . $search . '%')->orwhere(DB::raw('CONCAT(name," ",last_name)'), 'like', '%' . $search . '%')->orderBy('last_name')->paginate(15); } else { $users = User::where('id', Auth::user()->id)->paginate(15); } $selectedUser = self::__checkExistence($id); if (!$selectedUser) { $selectedUser = new User(); } $alerts = Alert::all(); $selectedUserAlerts = array(); if ($selectedUser->id) { $pivotData = $selectedUser->alerts; foreach ($pivotData as $current) { $selectedUserAlerts[$current->pivot->alerts_id]['fb'] = $current->pivot->to_facebook; $selectedUserAlerts[$current->pivot->alerts_id]['mail'] = $current->pivot->to_email; $selectedUserAlerts[$current->pivot->alerts_id]['sms'] = $current->pivot->to_sms; } } return View::make('alerts.main')->with('usersId', $id)->with('selectedUserAlerts', $selectedUserAlerts)->with('selectedUser', $selectedUser)->with('users', $users)->with('search', $search)->with('alerts', $alerts); }
/** * Show alert wrapper * * @return string Alert message */ public function showAlert() { $format = $this->system('alert_tpl'); foreach (\Alert::all($format) as $alert) { return $alert; } }