/**
  * checks whether new email is already in the database
  * old and new email can be similler for the selected admin only.
  *
  * @param string        $someString
  *
  * @return string
  */
 public function update(Request $request)
 {
     $email = $request->email;
     $id = $request->id;
     $job = $request->job;
     $firstname = $request->firstname;
     $lastname = $request->lastname;
     $admin = \DB::select('SELECT email FROM users WHERE email = "' . $email . '" not in
                                         (select email from users where id!=' . $id . ')');
     if ($this->CheckInternet()) {
         if ($admin == null) {
             //update
             \DB::table('users')->where('id', $id)->update(['firstname' => $firstname, 'lastname' => $lastname, 'job' => $job, 'email' => $email]);
             $sendMail = new EmailController();
             $content = 'Dear ' . $firstname . ', Your profile been Updated.
                 Your Email is ' . $email . ' Please visit
                 WWW.COUPLEY.COM/cp-admin#/AdminLogin';
             $subject = 'COUPLEY Administrator Update';
             $sendMail->SendMail($email, $firstname, $subject, $content);
             return response()->json(['you can use this email' => $admin, 'status' => 200], 200);
         } else {
             return response()->json(['email' => 'email already exists', 'status' => 201], 201);
         }
     } else {
         return response()->json(['status' => 203], 203);
     }
 }
예제 #2
0
 public function index()
 {
     if (\App\ValidacoesAcesso::PodeAcessarPagina(\Config::get('app.' . $this->rota)) == false) {
         return redirect('home');
     }
     $publicos = \App\Models\publicos::where('clientes_cloud_id', $this->dados_login->empresas_clientes_cloud_id)->get();
     $faixas = \App\Models\faixas::where('clientes_cloud_id', $this->dados_login->empresas_clientes_cloud_id)->get();
     /*Busca Lideres*/
     $lideres = \DB::select('select * from view_lideres where empresas_id = ? and empresas_clientes_cloud_id = ? ', [$this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     /*Busca vice - Lideres*/
     $vice_lider = \DB::select('select * from view_vicelideres where empresas_id = ? and empresas_clientes_cloud_id = ? ', [$this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     $var_download = "";
     $var_mensagem = "";
     /*Busca Niveis*/
     $view1 = \DB::select('select * from view_celulas_nivel1 v1 where v1.empresas_id = ? and v1.empresas_clientes_cloud_id = ? ', [$this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     $view2 = \DB::select('select * from view_celulas_nivel2 v2 where v2.empresas_id = ? and v2.empresas_clientes_cloud_id = ? ', [$this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     $view3 = \DB::select('select * from view_celulas_nivel3 v3 where v3.empresas_id = ? and v3.empresas_clientes_cloud_id = ? ', [$this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     $view4 = \DB::select('select * from view_celulas_nivel4 v4 where v4.empresas_id = ? and v4.empresas_clientes_cloud_id = ? ', [$this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     $view5 = \DB::select('select * from view_celulas_nivel5 v5 where v5.empresas_id = ? and v5.empresas_clientes_cloud_id = ? ', [$this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     $celulas_faixas = \DB::select('select * from view_total_celulas_faixa_etaria vw where vw.empresas_id = ? and vw.empresas_clientes_cloud_id = ? ', [$this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     $celulas_publicos = \DB::select('select * from view_total_celulas_publico_alvo vw where vw.empresas_id = ? and vw.empresas_clientes_cloud_id = ? ', [$this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     //Busca ID do cliente cloud e ID da empresa
     $this->dados_login = \App\Models\usuario::find(Auth::user()->id);
     return view($this->rota . '.index', ['dados' => '', 'celulas_faixas' => $celulas_faixas, 'celulas_publicos' => $celulas_publicos, 'vice_lider' => $vice_lider, 'nivel1' => $view1, 'nivel2' => $view2, 'nivel3' => $view3, 'nivel4' => $view4, 'nivel5' => $view5, 'publicos' => $publicos, 'faixas' => $faixas, 'lideres' => $lideres, 'var_download' => '', 'var_mensagem' => '']);
 }
예제 #3
0
 /**
  * reset uses to check,
  * whether user is registered,
  *  if it is, then update new password.
  *
  * @return string
  */
 public function reset(Request $request)
 {
     $credentials = $request->only('email', 'password');
     $newpassword = $request->newpassword;
     $mail = $request->email;
     try {
         // verify the credentials and create a token for the user
         if (!($token = JWTAuth::attempt($credentials))) {
             return response()->json(['error' => 'invalid_credentials', 'status' => 201], 201);
         }
     } catch (JWTException $e) {
         // something went wrong
         return response()->json(['error' => 'could_not_create_token', 'status' => 500], 500);
     }
     if ($this->CheckInternet()) {
         $adminName = \DB::select('SELECT firstname FROM users WHERE email = "' . $mail . '"');
         $sendMail = new EmailController();
         $content = 'Dear Administrator, your updated password is ' . $newpassword;
         $subject = 'COUPLEY Password Update';
         $sendMail->SendMail($mail, $adminName[0]->firstname, $subject, $content);
         $hashed = \Hash::make($newpassword);
         \DB::table('users')->where('email', $mail)->update(['password' => $hashed]);
         return response()->json(['password' => 'uptodate', 'status' => 200], 200);
     } else {
         return response()->json(['error' => 'No_network', 'status' => 203], 203);
     }
 }
예제 #4
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $level = \DB::select('select *from levels order by id desc');
     $data = \DB::table('levels')->where('id', '=', $id)->first();
     //untuk mengambil data berdasarkan id
     return view('level/edit')->with('data', $data, $level);
 }
예제 #5
0
 public function level()
 {
     $results = DB::select('select * from modul where id = ?', [1]);
     $sboleh = "select * from modul where script='" . $page . "'";
     $rboleh = $conn->Execute($sboleh);
     $ktm = -1;
     $RecordCount = $rboleh->RecordCount();
     if ($RecordCount > 0) {
         while ($wboleh = $rboleh->FetchRow()) {
             @($pos = strpos($wboleh['leveluser'], $_SESSION['level']));
             //$this->alert($wboleh['leveluser']." ".$_SESSION['level']);
             if ($pos === false) {
             } else {
                 $ktm = 1;
             }
         }
         if ($ktm <= 0) {
             echo "Anda Tidak Berhak Anda tidak berhak mengakses modul ini.<br />\n\t\t\t            Hubungi Sistem Administrator untuk memperoleh informasi lebih lanjut.\n\t\t\t            <hr size=1>\n\t\t\t            Pilihan: <a href='logout.php'>Logout</a>";
         } else {
             include_once $file . '.php';
         }
     } else {
         include_once $file . '.php';
     }
 }
예제 #6
0
 public function login_auth()
 {
     $user_id = Request::get('user_id');
     $user_password = Request::get('user_password');
     $result_list = \DB::select(\DB::raw("SELECT * FROM user_table"));
     foreach ($result_list as $result) {
         if ($result->user_id == $user_id) {
             if ($result->user_password == $user_password) {
                 if ($result->user_type == 'admin') {
                     $_SESSION['TICKET_USER_ID'] = $user_id;
                     $_SESSION['TICKET_USER_TYPE'] = $user_type;
                     return view('ticket_views.home');
                 }
                 if ($result->user_type == 'user') {
                     $client_id = $result->client_id;
                     if ($client_id == 'c_robi') {
                         $_SESSION['TICKET_USER_ID'] = $user_id;
                         $_SESSION['TICKET_USER_TYPE'] = $result->user_type;
                         $_SESSION['TICKET_USER_CLIENT_ID'] = $client_id;
                         $_SESSION['TICKET_USER_CLIENT_TYPE'] = 'telco';
                         return view('ticket_views.create_ticket_client');
                     }
                 }
             }
         }
     }
 }
 public function inbox()
 {
     $name = \Auth::user()->name;
     $results = \DB::select('select * from notification.inbox_' . $name . ' order by created_at desc limit 70 offset 0');
     \DB::update('update notification.inbox_' . $name . ' set n_read = true');
     return view('profile.inbox')->with('results', $results);
 }
예제 #8
0
 public function getbox()
 {
     $userid = \Auth::user()->id;
     $cart = \DB::select("SELECT COUNT(*) as numitems, SUM(totalprice) as totalprice, SUM(selqty) as quantity FROM currentcart WHERE userid = " . $userid);
     $currency = \DB::select("SELECT currency FROM users WHERE id = " . $userid);
     return view('cart.cartbox', array('cart' => $cart, 'currency' => $currency));
 }
예제 #9
0
 public function show($referen)
 {
     $empresa = Session::get('empresa');
     $pedimento = \DB::connection('users')->table('optr01')->select('ref_transport1', 'ref_tipo')->where('pk_referencia', $referen)->first();
     $result = \DB::select('select chk.id as id,chk_document,doc_nombre,chk_required from auditoria.aud_checklist chk INNER JOIN secenetc_master_mdb.mdb_tipodocum td ON chk.chk_document = td.doc_clave WHERE chk_opera = ? AND  chk_transport = ?', [$pedimento->ref_tipo, $pedimento->ref_transport1]);
     return view('administration.list')->with(['document' => $result, 'referen' => $referen]);
 }
 public function divideTeam($team, $min, $max, $boolit, $compID)
 {
     $len = count($team);
     $numTeam = $len / $min;
     $totalTeam = array();
     //$team = array_flip($team);
     //return $team;
     if ($boolit) {
         $a = array_keys($team);
     } else {
         $a = $team;
     }
     //print_r($a);
     while (count($a) >= $min) {
         $t = array();
         while (count($t) < $min) {
             array_push($t, array_pop($a));
             $a = array_reverse($a);
         }
         array_push($totalTeam, $t);
     }
     if (count($a) > 0 && count($totalTeam) > 0) {
         $i = 0;
         foreach ($a as $b) {
             array_push($totalTeam[$i % count($totalTeam)], $b);
             $i = $i + 1;
         }
     }
     $unsorted = array();
     $teamteam = array();
     //return $totalTeam;
     foreach ($totalTeam as $c) {
         if (count($c) > $max) {
             while (count($c) > $max) {
                 print_r($c);
                 array_push($unsorted, array_pop($c));
             }
             array_push($teamteam, $c);
         } else {
             array_push($teamteam, $c);
         }
     }
     if (count($teamteam) > 0) {
         foreach ($teamteam as $t) {
             team::create(['competition' => $compID, 'teamName' => 'Unnamed Team']);
             $val = \DB::select(\DB::raw('(SELECT max(teamID) as i FROM team)'));
             $teamID = $val[0]->i;
             foreach ($t as $s) {
                 //print_r($s);
                 //print_r(',');
                 team_contents::create(['teamID' => $teamID, 'studentID' => $s]);
                 \DB::table('student_competition')->where('studentID', '=', $s)->delete();
             }
         }
     }
     if (count($totalTeam == 0)) {
         return $a;
     }
     return $unsorted;
 }
예제 #11
0
 public function debug()
 {
     echo '<pre>';
     echo '<h1>Environment</h1>';
     echo \App::environment() . '</h1>';
     echo '<h1>Debugging?</h1>';
     if (config('app.debug')) {
         echo "Yes";
     } else {
         echo "No";
     }
     echo '<h1>Database Config</h1>';
     /*
     The following line will output your MySQL credentials.
     Uncomment it only if you're having a hard time connecting to the database and you
     need to confirm your credentials.
     When you're done debugging, comment it back out so you don't accidentally leave it
     running on your live server, making your credentials public.
     */
     //print_r(config('database.connections.mysql'));
     echo '<h1>Test Database Connection</h1>';
     try {
         $results = \DB::select('SHOW DATABASES;');
         echo '<strong style="background-color:green; padding:5px;">Connection confirmed</strong>';
         echo "<br><br>Your Databases:<br><br>";
         print_r($results);
     } catch (Exception $e) {
         echo '<strong style="background-color:crimson; padding:5px;">Caught exception: ', $e->getMessage(), "</strong>\n";
     }
     echo '</pre>';
 }
예제 #12
0
 public function postIndex()
 {
     $user_id = \Auth::user()->id;
     $reservedPersonalHours = \DB::select('SELECT reservedhours.id,categories.name,reservedhours.start FROM `reservedhours`,`categories`,`services` where DATE(reservedhours.start) = CURRENT_DATE and reservedhours.service_id = services.id AND services.category_id = categories.id and reservedhours.user_id =' . $user_id);
     $reservedPersonalHours = json_encode($reservedPersonalHours);
     return \Response::json(\View::make('partials.tasks', compact('reservedPersonalHours'))->render(), 200);
 }
예제 #13
0
 public function getSensor()
 {
     $id = $_SERVER['REMOTE_ADDR'];
     if (\DB::select('select 1 from module_vanguard where id = ?', [$id])) {
         if (\DB::select('select 1 from app_status where validity = true and sensor_register = true')) {
             $results = \DB::select('select * from module_vanguard where id = ?', [$id]);
             foreach ($results as $result) {
                 $alias = $result->alias;
                 $status = $result->status;
             }
             $timestamp = new \DateTime();
             if ($status == 'active') {
                 $must_report = true;
             }
             if ($status == 'passive') {
                 $must_report = false;
             }
             $is_reported = false;
             \DB::insert('insert into vanguard_log values (?, ?, ?, ?, ?)', [$id, $alias, $must_report, $is_reported, $timestamp]);
             //open to adjustment.
             exec("nodejs /var/www/topsus/nodejs/telegram_check.js");
             return 'OK';
         } else {
             return 'NOT OK - APPLICATION IS NOT LISTENING';
         }
     } else {
         return 'NOT OK - SENSOR IS INVALID';
     }
 }
 public function listaRaza()
 {
     $raza = DB::select('select * from Raza WHERE Activado = 1');
     for ($i = 0; $i < count($raza); $i++) {
         $Razas[$i] = new Raza($raza[i]->idRaza, $raza->Nombre, $raza->EstiloDePelo, $raza->Especie_idEspecie);
     }
     return $Razas;
 }
예제 #15
0
 public function testRedis()
 {
     // \Redis::set('feiyi', 'liuyan');
     // echo \Redis::get('feiyi');exit;
     $result = \DB::select('select * from articles');
     print_r($result);
     exit;
 }
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $stato = 2;
     $orders = \DB::select(\DB::raw("select count(1) as new_orders from (select * from ordini_stato where (data_creazione,ordine) in (select max(data_creazione), ordine from ordini_stato group by ordine) order by ordine desc) os where stato ='" . $stato . "'"));
     $newOrders = $orders[0]->new_orders;
     $users = \DB::table('utenti')->select(\DB::raw('count(1) as new_users'))->where('cancellato', '=', false)->where('confermato', '=', false)->first();
     $newUsers = $users->new_users;
     return view('dash', compact('newOrders', 'newUsers'));
 }
 /**
  * Retrieve the last 5
  * notifications of the admin.
  *
  * @return json
  */
 public function getNotificationList()
 {
     try {
         $notifications = \DB::select('SELECT * FROM AdminNotification order by id desc limit 5');
         return response()->json(['status' => 200, 'list' => $notifications], 200);
     } catch (QueryException $e) {
         return response()->json(['status' => 200], 200);
     }
 }
예제 #18
0
 /**
  * checks key value from request object and returns results according to.
  *
  * @param object        $request
  *
  *
  * @return json
  */
 public function search(Request $request)
 {
     $key = $request->key;
     $username = $request->username;
     //return $username;
     try {
         $data = User::where('username', $username)->get(['id', 'orientation', 'gender']);
         $userID = $data[0]->id;
         $orientation = $data[0]->orientation;
         $gender = $data[0]->gender;
         if ($orientation == 'straight' && $gender == 'female') {
             if ($users = \DB::select(\DB::raw("\n                        SELECT id,firstname,lastname,username,gender,profilepic from(\n                            SELECT id,firstname, lastname,username,orientation,gender,profilepic,role FROM `users` WHERE\n                                                    status = 'active' and\n                                                    firstname like '" . $key . "%' or \n                                                    lastname like '" . $key . "%') as t where orientation='straight' and gender='male' \n                                                    and role='user' and id NOT IN (\n                                                        Select blocked_user_id\n                                                        from `blocked`\n                                                        where user_id=" . $userID . '
                                                 ) 
                 '))) {
                 return response()->json(['users' => $users, 'status' => 201], 201);
             } elseif ($users == null) {
                 return response()->json(['users' => null, 'status' => 200], 200);
             }
         } elseif ($orientation == 'straight' && $gender == 'male') {
             $gender = 'female';
             if ($users = \DB::select(\DB::raw("\n                    SELECT id,firstname,lastname,username,gender,profilepic from(\n                        SELECT id,firstname, lastname,username,orientation,gender,profilepic,role FROM `users` WHERE        \n                                                status = 'active' and\n                                                firstname like '" . $key . "%' or \n                                                lastname like '" . $key . "%') as t where orientation='straight' and gender='female' \n                                                and role='user' and id NOT IN (\n                                                    Select blocked_user_id\n                                                    from `blocked`\n                                                    where user_id=" . $userID . '
                             ) 
                 '))) {
                 return response()->json(['users' => $users, 'status' => 201], 201);
             } else {
                 return response()->json(['users' => null, 'status' => 200], 200);
             }
         } elseif ($orientation == 'lesbian' && $gender == 'female') {
             if ($users = \DB::select(\DB::raw("\n                    SELECT id,firstname,lastname,username,gender,profilepic from(\n                        SELECT id,firstname, lastname,username,orientation,gender,profilepic,role FROM `users` WHERE        \n                                                status = 'active' and\n                                                firstname like '" . $key . "%' or \n                                                lastname like '" . $key . "%') as t where orientation='lesbian' and gender='female' \n                                                and role='user' and id NOT IN (\n                                                    Select blocked_user_id\n                                                    from `blocked`\n                                                    where user_id=" . $userID . '
                                             ) 
                 '))) {
                 return response()->json(['users' => $users, 'status' => 201], 201);
             } else {
                 return response()->json(['users' => null, 'status' => 200], 200);
             }
         } elseif ($orientation == 'gay' && $gender == 'male') {
             if ($users = \DB::select(\DB::raw("\n                    SELECT id,firstname,lastname,gender,profilepic from(\n                        SELECT id,firstname, lastname,username,orientation,gender,profilepic,role FROM `users` WHERE        \n                                                status = 'active' and\n                                                firstname like '" . $key . "%' or \n                                                lastname like '" . $key . "%') as t where orientation='gay' and gender='male' \n                                                and role='user' and id NOT IN (\n                                                    Select blocked_user_id\n                                                    from `blocked`\n                                                    where user_id=" . $userID . '
                                             ) 
                 '))) {
                 return response()->json(['users' => $users, 'status' => 201], 201);
             } else {
                 return response()->json(['users' => null, 'status' => 200], 200);
             }
         } elseif ($orientation == 'bisexual') {
             if ($users = \DB::select(\DB::raw("\n                    SELECT id,firstname,username,lastname,gender,profilepic from(\n                        SELECT id,firstname, lastname,username,orientation,gender,profilepic,role FROM `users` WHERE        \n                                                status = 'active' and\n                                                firstname like '" . $key . "%' or \n                                                lastname like '" . $key . "%') as t where orientation='bisexual' and (gender='male' or gender='female')  \n                                                and role='user' and id NOT IN (\n                                                    Select blocked_user_id\n                                                    from `blocked`\n                                                    where user_id=" . $userID . '
                                             ) 
                 '))) {
                 return response()->json(['users' => $users, 'status' => 201], 201);
             } else {
                 return response()->json(['users' => null, 'status' => 200], 200);
             }
         }
     } catch (QueryException $e) {
         return response()->json(['status' => 200, 'error' => true], 200);
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $coatch = Coatch::findOrFail($id);
     $functionMY = \DB::select(\DB::raw("select nazwa({$id})"));
     $licences = CoatchLicence::get();
     if (empty($licences)) {
         return redirect()->route('coatch_licences.index')->with('message', 'Najpierw dodaj  licencje.');
     }
     return view('coatches.show', compact('coatch'))->with('list', self::getLicence($licences))->with('MYK', $functionMY);
 }
예제 #20
0
 public function blocked()
 {
     try {
         if ($users = \DB::select('select * from users where status="rogue" and role="user"')) {
             return response()->json(['users' => $users, 'status' => 200], 200);
         }
     } catch (Illuminate\Database\QueryException $e) {
         return response()->json(['status' => 505], 505);
     }
 }
예제 #21
0
 public function approveEditRequest($id)
 {
     $result = \DB::select('SELECT * FROM `store_edit_requests` WHERE id=?', [$id]);
     $result = $result[0];
     try {
         \DB::update("UPDATE stores SET `{$result->key}` = '{$result->value}' WHERE id={$result->store_id}");
     } catch (\Exception $e) {
         \DB::insert("INSERT INTO `store_metas` (`id`, `store_id`, `key`, `value`, `created_at`, `updated_at`) VALUES (NULL, ?, ?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)", [$result->store_id, $result->key, $result->value]);
     }
     \DB::update('UPDATE `store_edit_requests` SET approved=1 WHERE id=?', [$id]);
 }
예제 #22
0
 public function reportpengeluaran()
 {
     $artikel = array('data' => DB::table('setorans'));
     if (!empty($artikel)) {
         $data = array('data' => DB::select('select *from setorans'));
         $pdf = \PDF::loadview('report.reportpengeluaran', $data);
         return $pdf->stream('setorans.pdf');
     } else {
         return redirect(url());
     }
 }
예제 #23
0
 /**
  * search uses to retrieve registered user data.
  * @param object    $request
  *
  * @return json
  */
 public function search(Request $request)
 {
     $key = $request->key;
     try {
         if ($users = \DB::select('select * from users WHERE role="user" and firstname like "' . $key . '%"
         union select * from users WHERE role="user" and lastname like "' . $key . '%"')) {
             return response()->json(['users' => $users, 'status' => 201], 201);
         }
     } catch (Illuminate\Database\QueryException $e) {
         return response()->json(['status' => 200], 200);
     }
 }
예제 #24
0
 public function renderVideoByCategory($id)
 {
     $articles = Article::where('is_publish', '1');
     $ids = array();
     $categories = \DB::select('select * from article_categories where categories_id = ?', array($id));
     foreach ($categories as $value) {
         $ids[] = $value->article_id;
     }
     $articles = $articles->whereIn('id', $ids)->get()->toArray();
     // Render View With Parameters
     return \View::make('article.bycategory')->with('articles', $articles);
 }
예제 #25
0
 private function exibir($request, $id, $preview)
 {
     if ($request->ajax()) {
         return URL::to($this->rota . '/' . $id . '/edit');
     }
     if (\App\ValidacoesAcesso::PodeAcessarPagina(\Config::get('app.' . $this->rota)) == false) {
         return redirect('home');
     }
     /*Busca NIVEL1*/
     $dados = \DB::select('select * from view_celulas_nivel1 v1 where v1.id = ? and  v1.empresas_id = ? and v1.empresas_clientes_cloud_id = ? ', [$id, $this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     return view($this->rota . '.edit', ['dados' => $dados, 'preview' => $preview]);
 }
예제 #26
0
 public function CarregarView($var_download, $var_mensagem)
 {
     /*Busca Lideres*/
     $lideres = \DB::select('select * from view_lideres where empresas_id = ? and empresas_clientes_cloud_id = ? ', [$this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     $cursos = \App\Models\cursos::where(['empresas_id' => $this->dados_login->empresas_id, 'empresas_clientes_cloud_id' => $this->dados_login->empresas_clientes_cloud_id])->orderBy('nome', 'ASC')->get();
     /*Busca Niveis*/
     $view1 = \DB::select('select * from view_celulas_nivel1 v1 where v1.empresas_id = ? and v1.empresas_clientes_cloud_id = ? ', [$this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     $view2 = \DB::select('select * from view_celulas_nivel2 v2 where v2.empresas_id = ? and v2.empresas_clientes_cloud_id = ? ', [$this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     $view3 = \DB::select('select * from view_celulas_nivel3 v3 where v3.empresas_id = ? and v3.empresas_clientes_cloud_id = ? ', [$this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     $view4 = \DB::select('select * from view_celulas_nivel4 v4 where v4.empresas_id = ? and v4.empresas_clientes_cloud_id = ? ', [$this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     $view5 = \DB::select('select * from view_celulas_nivel5 v5 where v5.empresas_id = ? and v5.empresas_clientes_cloud_id = ? ', [$this->dados_login->empresas_id, $this->dados_login->empresas_clientes_cloud_id]);
     return view($this->rota . '.index', ['cursos' => $cursos, 'nivel1' => $view1, 'nivel2' => $view2, 'nivel3' => $view3, 'nivel4' => $view4, 'nivel5' => $view5, 'lideres' => $lideres, 'var_download' => $var_download, 'var_mensagem' => $var_mensagem]);
 }
 public function getRatingSingle()
 {
     $users = \DB::select("select user_id,count(*) as tourny_played,sum(total_score) as total_score,sum(user_position) as points from k_tournament_user where user_status > 2 group by user_id order by points DESC, total_score DESC;");
     $us = new Collection();
     foreach ($users as $user) {
         $u = User::find($user->user_id);
         $u->total_score = $user->total_score;
         $u->tourny_played = $user->tourny_played;
         $u->points = $user->points;
         $us->push($u);
     }
     return view('tournament.rankingsingle')->with('players', $us)->with('ranking', 1);
 }
예제 #28
0
 public function getLikedUsers(Request $request)
 {
     $postId = $request->postId;
     try {
         $posts = \DB::select('select firstname,post_id,username
                              from activitylikes 
                              where post_id=' . $postId . '
                              order by created_at desc');
         return response()->json(['posts' => $posts, 'status' => 200], 200);
     } catch (Illuminate\Database\QueryException $e) {
         return response()->json(['status' => 505], 505);
     }
 }
예제 #29
0
 public function dashboard()
 {
     $thisWeekDeadline = \DB::select("SELECT COUNT(0) as cnt FROM tasks WHERE completed_at IS NULL AND due_date < ?", [Carbon::now()->addWeek()])[0]->cnt;
     $assignedToYou = \DB::select("SELECT COUNT(0) as cnt \n                                FROM tasks \n                                INNER JOIN task_user ON tasks.id = task_user.task_id\n                                WHERE completed_at IS NULL\n                                AND task_user.user_id = ?", [\Auth::user()->id])[0]->cnt;
     $completedCount = \DB::select("select sum(isnull(completed_at)) as not_completed, sum(not isnull(completed_at)) as completed from tasks group by completed_at;")[0];
     /*$tasksCount = \DB::table('tasks')
               ->select('project_id', 'completed_at', \DB::raw('COUNT(0) total'))
               ->groupBy('project_id', 'completed_at')
               ->get();
       dd($tasksCount);*/
     $latest = Task::latest()->whereNull('completed_at')->with('project')->take(25)->get();
     return view('dashboard.dashboard', ['latest' => $latest, 'thisWeekDeadline' => $thisWeekDeadline, 'assignedToYou' => $assignedToYou, 'completedCount' => $completedCount, 'faker' => \Faker\Factory::create()]);
 }
예제 #30
0
 /**
  * get trend search list.
  *
  * @param object        $request
  *
  *
  * @return json
  */
 public function getInitPosttrends(Request $request)
 {
     $trends = $request->trend;
     try {
         if ($inittrendposts = \DB::select(\DB::raw("\n                     SELECT *\n                     FROM activityposts\n                     WHERE id IN ( SELECT id\n                                   FROM (SELECT id,username,SUBSTRING(post_text,LOCATE('#',post_text),15) AS trend\n                                         FROM activityposts\n                                         WHERE post_text like '%#%') t\n                                   WHERE trend IN (SELECT SUBSTRING(post_text,LOCATE('#',post_text),15) AS trend FROM activityposts WHERE post_text like '%#%' HAVING MAX(id))\n\n                                    )"))) {
             return response()->json(['inittrendposts' => $inittrendposts, 'status' => 200], 200);
         } else {
             return response()->json(['status' => 505], 505);
         }
     } catch (Illuminate\Database\QueryException $e) {
         return response()->json(['status' => 200], 200);
     }
 }