本文整理汇总了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);
}
示例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();
}
示例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;
}
}
示例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);
}
}
示例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');
}
示例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'));
}
}
示例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);
}
示例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');
}
}
示例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);
}
示例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');
}
}
示例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";
}
}
}
}
示例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();
}
}
}
示例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);
}
示例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();
}
}
示例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;
}