当前位置: 首页>>代码示例>>PHP>>正文


PHP Users::where方法代码示例

本文整理汇总了PHP中Users::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::where方法的具体用法?PHP Users::where怎么用?PHP Users::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Users的用法示例。


在下文中一共展示了Users::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: batal_bergabung

 public function batal_bergabung($id)
 {
     $iduser = Users::where('id', '=', Session::get('user_id'))->first()->id;
     $slug = Acara::where('id', '=', $id)->first()->slug;
     UserEvent::where('id_user', '=', $iduser)->where('id_acara', '=', $id)->delete();
     return Redirect::to('/acara/' . $slug);
 }
开发者ID:kelimuttu,项目名称:Item-based-CF-in-Serentak,代码行数:7,代码来源:EventController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  * POST
  * @return Response
  */
 public function store()
 {
     $uid = Input::get('uid');
     $following_uid = Input::get('following_uid');
     $Following = new Following();
     $Following->following_uid = $following_uid;
     $Following->uid = $uid;
     $Following->save();
     return Users::where('uid', $uid)->get();
 }
开发者ID:mikepierre,项目名称:social-profile-api,代码行数:15,代码来源:FollowingController.php

示例3: isExistedUser

 /**
  * 
  * @param string $field field in table to check. Default is account
  * @return boolean
  */
 public static function isExistedUser($field = 'account')
 {
     $data = Input::all();
     $user = Users::where($field, $data["{$field}"])->first();
     if ($user) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:huuson94,项目名称:WebProject,代码行数:15,代码来源:FEUsersHelper.php

示例4: check

 public function check($fbid)
 {
     $check = Users::where('fbid', '=', $fbid)->count();
     if (empty($check)) {
         return FALSE;
         // Users::create($data);
     } else {
         return TRUE;
         // Users::where('fbid', '=', $fbid)->update($data);
     }
 }
开发者ID:kelimuttu,项目名称:Item-based-CF-in-Serentak,代码行数:11,代码来源:FacebookController.php

示例5: login

 public function login($language)
 {
     // Définition de la langue :
     if (!$this->setupLanguage($language)) {
         App::abort(404);
     }
     try {
         $languages = Language::where('_url', '=', $language)->firstOrFail();
         $page = Pages::where('_language', $languages->_id)->where("_name", "=", "user/login")->get()->first();
     } catch (Exception $e) {
         App::abort(500);
     }
     // Redirection de l'utilisateur s'il est déjà connecté :
     if (Auth::check()) {
         return Redirect::to(URL::to($language . '/home'));
     }
     // Variables :
     // Details :
     $data = array("situation" => array("title" => $page->_title, "description" => $page->_description), "position" => array($page->_title => ""));
     // Message :
     $message = "";
     // Inputs :
     $login = "";
     $password = "";
     // Envoi du formulaire de connexion :
     if (count(Input::all()) > 0) {
         // récupération des inputs :
         $login = htmlentities(Input::get('your-login'));
         $password = htmlentities(Input::get('your-password'));
         // validation des formulaire :
         $validator = Validator::make(array('email' => $login, 'password' => $password), array('email' => 'required|email', 'password' => 'required'), array('email.required' => Lang::get('libelle.CONNEXION_ERROR_IDENTIFIANT_RQ'), 'email.email' => Lang::get('libelle.CONNEXION_ERROR_IDENTIFIANT_INV'), 'password.required' => Lang::get('libelle.CONNEXION_ERROR_PASSWORD_RQ')));
         // retour en cas d'erreur :
         if ($validator->fails()) {
             $message = $validator->messages();
         } else {
             // connexion en cas de succès :
             $auth = Users::where('_email', '=', $login)->where('_password', '=', md5($password))->first();
             // si utilisateur trouvé, redirection :
             if ($auth) {
                 Auth::login($auth);
                 Auth::user()->_ipLastConnection = Request::getClientIp(true);
                 Auth::user()->_dateLastConnection = date("Y-m-d H:i:s");
                 Auth::user()->save();
                 return Redirect::to(URL::to($language . '/home'));
             } else {
                 $message = Lang::get("libelle.CONNEXION_ERROR");
             }
         }
     }
     // Renvoi de la vue avec les message(s) d'erreurs :
     $page = $this->layout->content = View::make('pages.users.login', array("data" => $data, "page" => $page, "message" => $message));
     return Response::make($page, '200');
 }
开发者ID:Benoit-ROBIN,项目名称:u-hochiminh,代码行数:53,代码来源:UsersController.php

示例6: changeName

 public function changeName()
 {
     $name = Input::get('name');
     $uid = Session::get('uid');
     $user = Users::where('uid', $uid)->first();
     if ($user) {
         $user->username = $name;
         $user->save();
         return json_encode(array('status' => 'success'));
     } else {
         return json_encode(array('status' => 'failed'));
     }
 }
开发者ID:mkhairul,项目名称:mydd2014,代码行数:13,代码来源:UserController.php

示例7: authenticate

 /**
  * Performs an authentication
  * @param  array
  * @return Nette\Security\Identity
  * @throws Nette\Security\AuthenticationException
  */
 public function authenticate(array $credentials)
 {
     if (count($credentials) == 1) {
         $row = $this->users->where('hash', $credentials[0])->fetch();
         if (!$row) {
             throw new NS\AuthenticationException("User not found.", self::IDENTITY_NOT_FOUND);
         }
     } else {
         list($username, $password) = $credentials;
         $row = $this->users->where('username', $username)->fetch();
         if (!$row) {
             throw new NS\AuthenticationException("User '{$username}' not found.", self::IDENTITY_NOT_FOUND);
         }
         if ($row->password !== $this->users->calculateHash($password)) {
             throw new NS\AuthenticationException("Invalid password.", self::INVALID_CREDENTIAL);
         }
         $this->users->get($row->id)->update(array('last_login' => new DibiDateTime(), 'last_ip' => $_SERVER['REMOTE_ADDR']));
     }
     $data = $row->toArray();
     unset($data['password']);
     return new NS\Identity($row->id, $row->role, $data);
 }
开发者ID:soundake,项目名称:pd,代码行数:28,代码来源:Authenticator.php

示例8: getAuth

 public function getAuth()
 {
     $username = Input::get('username');
     $pass = Input::get('password');
     $password = md5($pass);
     $cek = Users::where('username', '=', $username)->where('password', '=', $password)->first();
     if (empty($cek)) {
         Session::flash('message', 'Wrong');
         return Redirect::to('/');
     } else {
         Session::put('username', $username);
         Session::put('employee_id', $cek->employee_id);
         Session::flash('message', 'Login was successfully, Welcome ' . $username);
         return Redirect::to('dashboard');
     }
 }
开发者ID:andrinda,项目名称:myhotel,代码行数:16,代码来源:HomeController.php

示例9: get_data_for_dashboard

 public function get_data_for_dashboard()
 {
     $userid = Users::where('id', '=', Session::get('user_id'))->first()->id;
     $data['user'] = Users::find(Session::get('user_id'));
     $data['komunitas'] = Komunitas::orderBy('avg_rate', 'DESC')->take(5)->get();
     $data['rekomen'] = $this->predict->recommendation($userid);
     $data['rating'] = $this->rating->count_rate_row_by_id($userid);
     $data['cek'] = $this->predict->has_recommendation($userid);
     $data['rand'] = Komunitas::orderByRaw("RAND()")->take(5)->get();
     // $data['test'] = $this->komunitas->get_recommendation($userid);
     // $data['komunitas'] = $this->komunitas->get_initial_recommendation();
     $data['acara'] = Acara::where('tanggal', '>=', DB::raw('CURDATE()'))->take(4)->orderBy('tanggal', 'ASC')->get();
     // $count = Komunitas::where('id_kategori', '=', 1)->count();
     $allkom = $this->predict->has_recommendation($userid);
     //var_dump($allkom);
     //var_dump($data['test']);
     return View::make('dashboard', $data);
 }
开发者ID:kelimuttu,项目名称:Item-based-CF-in-Serentak,代码行数:18,代码来源:RecommendationController.php

示例10: edit

 function edit($id)
 {
     //$user = $this->Users_model->get_user_by_id($id);
     $userModel = new Users();
     $user = $userModel->where('idusers', $id)->get();
     $form_rules = array(array('field' => 'login', 'label' => $this->lang->line('login'), 'rules' => 'required|max_length[16]'), array('field' => 'password', 'label' => $this->lang->line('password'), 'rules' => 'required|max_length[16]|matches[confirm]'), array('field' => 'name', 'label' => $this->lang->line('name'), 'rules' => 'required|max_length[32]'), array('field' => 'type', 'label' => $this->lang->line('user_type'), 'rules' => 'required'));
     $this->form_validation->set_rules($form_rules);
     if ($this->form_validation->run() == FALSE) {
         $this->load->view('template/editUser', array('user' => $user, 'action' => 'edit/' . $id));
     } else {
         $user = new Users();
         $user->idusers = $_POST['idusers'];
         $user->login = $_POST['login'];
         $user->password = $_POST['password'];
         $user->name = $_POST['name'];
         $user->type = $_POST['type'];
         $user->language = $_POST['language'];
         $user->edit();
         redirect('/admin/user');
     }
 }
开发者ID:mayurz,项目名称:cidmel,代码行数:21,代码来源:user.php

示例11: store

 public function store()
 {
     $data = Input::all();
     $validator = FEUsersHelper::validateLoginInfo();
     if ($validator->fails()) {
         $messages = $validator->messages();
         echo json_encode($messages);
     } else {
         $user = Users::where('account', $data['account'])->get()->first();
         if (!$user) {
             echo "fail: Not exists user";
         } else {
             $user = Users::where('account', $data['account'])->where('password', md5($data['password']))->first();
             if (!$user) {
                 echo "fail: incorrect password";
             } else {
                 Session::put('user', $user);
                 echo "success";
             }
         }
     }
 }
开发者ID:huuson94,项目名称:WebProject,代码行数:22,代码来源:SessionsController.php

示例12: signin

 public function signin(array $params = array())
 {
     /**
      * @Desc: needs two params : email + password
      * @Desc2: Optional params : keepAlive
      */
     /*
      * TODO: Confirm the system.
      * TODO: Error checking and Flash Session
      */
     $email = $params["email"];
     $password = $params["'password'"];
     $u = \Users::where("email", $email)->first();
     // STEP 2: Compare
     $compare = Criptography::compare($password, $u["password"]);
     if ($compare) {
         Session::set("user_id", $u["id"]);
         Session::set("email", $u["email"]);
         // STEP 3: SET INFINITE SESSION
         if (isset($params["keepAlive"])) {
             $this->setRememberMe();
         }
     }
 }
开发者ID:pihh,项目名称:mariana-framework,代码行数:24,代码来源:auth.controller.php

示例13: batal_bergabung

 public function batal_bergabung($id)
 {
     $iduser = Users::where('id', '=', Session::get('user_id'))->first()->id;
     $slug = Komunitas::where('id', '=', $id)->first()->slug;
     KomunitasMember::where('id_user', '=', $iduser)->where('id_komunitas', '=', $id)->delete();
     return Redirect::to('/komunitas/' . $slug);
 }
开发者ID:kelimuttu,项目名称:Item-based-CF-in-Serentak,代码行数:7,代码来源:KomunitasController.php

示例14: postDoblast

 function postDoblast()
 {
     $rules = array('subject' => 'required', 'message' => 'required|min:10', 'groups' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         if (!is_null(Input::get('groups'))) {
             $groups = Input::get('groups');
             for ($i = 0; $i < count($groups); $i++) {
                 if (Input::get('uStatus') == 'all') {
                     $users = Users::all()->where('group_id', '=', $groups[$i]);
                 } else {
                     $users = Users::where('active', '=', Input::get('uStatus'))->where('group_id', '=', $groups[$i]);
                 }
                 $count = 0;
                 foreach ($users as $row) {
                     $to = $row->email;
                     $subject = Input::get('subject');
                     $message = Input::get('message');
                     $headers = 'MIME-Version: 1.0' . "\r\n";
                     $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
                     $headers .= 'From: ' . CNF_APPNAME . ' <' . CNF_EMAIL . '>' . "\r\n";
                     mail($to, $subject, $message, $headers);
                     $count = ++$count;
                 }
             }
             return Redirect::to('config/blast')->with('messagetext', 'Total ' . $count . ' Message has been sent')->with('msgstatus', 'success');
         }
         return Redirect::to('config/blast')->with('messagetext', 'No Message has been sent')->with('msgstatus', 'info');
     } else {
         return Redirect::to('config/blast')->with('messagetext', 'The following errors occurred')->with('msgstatus', 'error')->withErrors($validator)->withInput();
     }
 }
开发者ID:buguelos,项目名称:make,代码行数:32,代码来源:ConfigController.php

示例15: getDriverById

 public function getDriverById()
 {
     $driverId = Input::get('driver_id');
     try {
         $driver = Driver::find($driverId);
         $email = Users::where('id', '=', $driver->user_id)->pluck('email');
         $driver->email = $email;
         $result = array('success' => true, 'driver' => $driver);
     } catch (Exception $ex) {
         \Log::error(__METHOD__ . ' | error :' . print_r($ex, 1));
         $result = array('success' => false, 'driver' => null);
     }
     return $result;
 }
开发者ID:ardyaryan,项目名称:presidential-car-api,代码行数:14,代码来源:AdminController.php


注:本文中的Users::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。