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


PHP user::where方法代码示例

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


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

示例1: updateProfile

 function updateProfile()
 {
     $userId = Session::get('user_id');
     if (!isset($userId)) {
         return json_encode(array('message' => 'not logged'));
     }
     $user = user::find($userId);
     if (isset($user)) {
         $email = Input::get('email');
         $userByEmail = user::where('email', '=', $email)->first();
         if (isset($userByEmail) && $userByEmail->id != $user->id) {
             echo 'duplicate';
         } else {
             $user->id = $userId;
             $user->email = $email;
             $user->name = Input::get('name');
             $user->password = Input::get('password');
             $user->user_type = Input::get('user_type');
             $user->save();
             return json_encode(array('message' => 'done'));
         }
     } else {
         return json_encode(array('message' => 'invalid'));
     }
 }
开发者ID:ashutoshpandey,项目名称:course,代码行数:25,代码来源:UserController.php

示例2: login

 public static function login($email, $password)
 {
     $user = user::where('email', $email)->where('password', sha1(TinyMvc::app()->config['salt'] . $password))->getOne();
     if (!$user) {
         return false;
     }
     $user->lastlogindate = date("Y-m-d H:i:s");
     $user->lastloginip = $_SERVER['REMOTE_ADDR'];
     $user->save();
     return $user;
 }
开发者ID:avbdr,项目名称:tinymvc-php,代码行数:11,代码来源:user.php

示例3: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $lastlogin = table_last_login::where('last_login_id', '=', $id)->first();
     $user = user::where('id', '=', $lastlogin->users_id)->first();
     if ($user != null) {
         $username = $user->name;
     } else {
         $username = '';
     }
     $data = array('user_name' => $username, 'last_login' => table_last_login::where('last_login_id', '=', $id)->get(), 'users_detail' => json_encode(DB::select('select users_id as id, users_name as value, users_name as label from table_users_detail')));
     return view('admin.database.last-login.last-login-edit', compact('data'));
 }
开发者ID:ekobudiarto,项目名称:msjd,代码行数:18,代码来源:controller_last_login.php

示例4: handleProviderCallback

 public function handleProviderCallback()
 {
     $user = socialite::driver('facebook')->user();
     $data = ['name' => $user->name, 'email' => $user->email, 'password' => $user->token];
     $userDB = user::where('email', $user->email)->first();
     if (!is_null($userDB)) {
         Auth::login($userDB);
     } else {
         # code...
         Auth::login($this->create($data));
     }
     return Redirect('/home');
 }
开发者ID:andreaschristian,项目名称:laravel,代码行数:13,代码来源:AuthController.php

示例5: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $wanted = user::where('id', $id)->first();
     if (is_null($wanted)) {
         return "Not Found";
     } else {
         $doctor = Doctor::where('email', '=', $wanted->email)->first();
         $count = tickets::where('userid', $wanted->id)->count();
         $countAppointment = doctorSchedule::where('uid', '=', $wanted->id)->count();
         if (is_null($doctor)) {
             return view('user.profileview')->with('user', Session::get('user'))->with('viewing', $wanted)->with('ticketCount', $count)->with('appointmentCount', $countAppointment);
         } else {
             return view('user.profileview')->with('user', Session::get('user'))->with('viewing', $wanted)->with('doctor', $doctor)->with('ticketCount', $count)->with('appointmentCount', $countAppointment);
         }
     }
 }
开发者ID:dprabhath,项目名称:SEP_WE_016,代码行数:22,代码来源:profileviewer.php

示例6: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     if (!Auth::guest()) {
         $user = User::where('priviledge', '!=', 'superuser')->get();
         $user_designation = Designation::where('id', '=', Auth::user()->id)->pluck('designation');
         $user_votes = Vote::where('user_id', '=', Auth::user()->id)->get();
         $count = count($user_votes);
         $i = 0;
         foreach ($user_votes as $user_vote) {
             $user_name[$i] = user::where('id', '=', $user_vote->login_id)->pluck('user_name');
             $i++;
         }
         //var_dump($user_name);die;
         $weights = Vote::where('user_id', '=', Auth::id())->sum('performance');
         $sum = $weights;
         $name = priviledge::where('user_id', '=', Auth::user()->id)->pluck('name_show');
         $path = file::where('user_id', '=', Auth::user()->id)->pluck('path');
         $authority = Priviledge::all();
         return View::make('votes.profile', compact('authority', 'path', 'user_designation', 'user_votes', 'sum', 'user', 'name', 'user_name'));
     } else {
         return Redirect::intended('login');
     }
 }
开发者ID:shihab-92,项目名称:votting-system,代码行数:28,代码来源:profileController.php

示例7: user

    if (get_class($d) != 'product') {
        echo "wrong class returned\n";
        exit;
    }
    if (!$p->userId instanceof user) {
        echo "wrong return class of hasOne result\n";
        exit;
    }
    $cnt++;
}
if ($cnt != $db->count && $cnt != 5) {
    echo "wrong count after get\n";
    exit;
}
// hasMany
$user = user::where('id', 1)->getOne();
if (!is_array($user->products) || count($user->products) != 3) {
    echo "wrong count in hasMany\n";
    exit;
}
foreach ($user->products as $p) {
    if (!$p instanceof product) {
        echo "wrong return class of hasMany result\n";
        exit;
    }
}
// multi save
$client = new user();
$client->login = 'testuser';
$client->firstName = 'john';
$client->lastName = 'Doe Jr';
开发者ID:TwistItLabs,项目名称:website,代码行数:31,代码来源:dbObjectTests.php

示例8: function

<?php

$app->group('/user', function () use($app) {
    $app->get('/', function () use($app) {
        $data = json_decode($app->request->getBody(), true);
        $results = [];
        $results["user"] = [];
        $results["success"] = "false";
        if (validatedKey($data["user"]["id"], $data["user"]["key"])) {
            $user = user::where('id', '=', $data["user"]["id"])->first();
            $results["user"] = $user;
            $results["success"] = "true";
        } else {
            $results["success"] = "false";
            $results["error"] = "No auth";
        }
        echo json_encode($results);
    });
    $app->post('/photo', function () use($app) {
        $data = json_decode($_POST['data'], true);
        $results = [];
        $results["success"] = "false";
        if (validatedKey($data['user'])) {
            if ($_FILES['file']['name'] != "") {
                // El campo foto contiene una imagen...
                // Primero, hay que validar que se trata de un JPG/GIF/PNG
                $allowedExts = array("jpg", "jpeg", "gif", "png", "JPG", "GIF", "PNG");
                $ext = end(explode(".", $_FILES["file"]["name"]));
                if (($_FILES["file"]["type"] == "image/gif" || $_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/png" || $_FILES["file"]["type"] == "image/pjpeg") && in_array($ext, $allowedExts)) {
                    $ext = end(explode('.', $_FILES['file']['name']));
                    $photo = substr(md5(uniqid(rand())), 0, 10) . "." . $ext;
开发者ID:devsnippet,项目名称:sobic,代码行数:31,代码来源:user.php

示例9: inputs

 /**
  * Take All JSON Post Requset and process them
  *  Tasks
  *	 1. Reset Passwords
  *	 2. Login
  *	 3. Send Emails when Password is resetted
  *
  * @return Response, Views
  **/
 public function inputs()
 {
     $user = Session::get('user');
     if (is_null($user) || $user->verified == 1) {
         return response()->json(['message' => 'Missmatch Data', 'code' => 'error']);
     }
     if (Request::get('task') == "sendEmail") {
         /**
          *
          *	Send the Email including the activation code
          *
          */
         $email = Request::get('email');
         if (is_null($email) || trim($email) == "" || !preg_match("/^([a-zA-Z0-9_.+-])+\\@(([a-zA-Z0-9-])+\\.)+([a-zA-Z0-9]{2,4})+\$/", $email)) {
             return response()->json(['message' => 'Missmatch Data', 'code' => 'error', 'task' => 'sendEmail']);
         }
         if ($user->email != $email) {
             $checkUser = user::where('email', $email)->count();
             if ($checkUser == 0) {
                 $user->email = $email;
             } else {
                 return response()->json(['message' => 'Email already Registerd', 'code' => 'error', 'task' => 'sendEmail']);
             }
         }
         Mail::send('mailtemplate/emailVerify', ['name' => $user->name, 'code' => Session::get('emailKey')], function ($m) use($user) {
             $m->from('daemon@mail.altairsl.us', 'Native Physician');
             $m->to($user->email, $user->name)->subject('Confirmation Code');
         });
         $user->save();
         Session::put('user', $user);
         return response()->json(['message' => 'Ok', 'code' => 'success', 'task' => 'sendEmail', 'email' => $email]);
     } elseif (Request::get('task') == "sendPhone") {
         /**
          *
          *	Send the MMS including the activation code
          *
          */
         $smsLimit = smslimit::where('uid', '=', Session::get('userid'))->first();
         if (is_null($smsLimit)) {
             $smsLimit = new smslimit();
             $smsLimit->uid = Session::get('userid');
             $smsLimit->count = 1;
             $smsLimit->save();
         } else {
             if ($smsLimit->count >= 2) {
                 return response()->json(['message' => 'you can only sent 2 SMS within a Day', 'code' => 'error', 'task' => 'sendPhone']);
             } else {
                 $smsCount = $smsLimit->count;
                 $smsCount++;
                 $smsLimit->count = $smsCount;
                 $smsLimit->save();
             }
         }
         $phone = Request::get('phone');
         if (is_null($phone) || trim($phone) == "" || !preg_match("/^[0-9]{9}\$/", $phone)) {
             return response()->json(['message' => 'Check your Phone number', 'code' => 'error', 'task' => 'sendPhone']);
         }
         $phone = "+94" . $phone;
         if ($user->tp != trim($phone)) {
             $checkUser = user::where('tp', $phone)->count();
             if ($checkUser == 0) {
                 $user->tp = trim($phone);
             } else {
                 return response()->json(['message' => 'phone already Registerd', 'code' => 'error', 'task' => 'sendPhone']);
             }
         }
         $code = Session::get('phoneKey');
         if (is_null($code)) {
             return response()->json(['message' => 'Refresh the page', 'code' => 'error', 'task' => 'sendPhone']);
         }
         $user->save();
         Session::put('user', $user);
         SMS::queue('Your Confirmation Code is: ' . $code, [], function ($sms) use($phone) {
             $sms->to($phone);
         });
         //$this->sendsms('Your Confirmation Code is: '.$code,$phone);
         /*
         Mail::send('mailtemplate/emailVerify', ['name'=> $user->name,'code'=>Session::get('phoneKey')], function ($m) use ($user,$phone,$code) {
         	$m->from('hello@app.com', 'Your Application');
         
         	$m->to($phone."@mms.dialog.lk", $user->name)->subject($code);
         });
         */
         return response()->json(['message' => 'Ok', 'code' => 'success', 'task' => 'sendPhone', 'phone' => $phone]);
     } elseif (Request::get('task') == "verify") {
         /**
          *
          *	Finalized the registration by comparing activation codes
          *
          */
         $codePhone = Request::get('codePhone');
//.........这里部分代码省略.........
开发者ID:dprabhath,项目名称:SEP_WE_016,代码行数:101,代码来源:VerifyController.php

示例10: inputs

 /**
  * Get all the JSON POST requests and process them
  * Tasks
  * 1. Upload the pictures and change the profile picture
  * 2. Change NIC
  * 3. Change Password
  * 4. Change Name
  * @return JSON Response
  */
 public function inputs()
 {
     $user = Session::get('user');
     if (is_null($user)) {
         return response()->json(['message' => 'hacker']);
     }
     if (Request::get('formname') == "picture") {
         /**
          *	Change the profile picture
          *
          */
         if (Input::file('pic')->isValid()) {
             $allowed = array('gif', 'png', 'jpg');
             $image = Input::file('pic');
             if ($image->getSize() > 614348) {
                 return response()->json(['message' => 'File size is too large', 'code' => 'warning']);
             }
             if (!in_array($image->getClientOriginalExtension(), $allowed)) {
                 return response()->json(['message' => 'Please Upload an image', 'code' => 'error']);
             }
             $destinationPath = base_path() . '/../public/uploads/profile_pics';
             $fullPath = 'uploads/profile_pics/' . Session::get('userid') . '.' . $image->getClientOriginalExtension();
             try {
                 $image->move($destinationPath, Session::get('userid') . '.' . $image->getClientOriginalExtension());
             } catch (Exception $e) {
                 return response()->json(['message' => 'Error saving the file', 'code' => 'error']);
             }
             $user->pic = $fullPath;
             $user->save();
             $this->updateSession();
             return response()->json(['message' => 'Profile picture updated!', 'filename' => $fullPath, 'code' => 'success']);
         } else {
             return response()->json(['message' => 'Upload an different image', 'code' => 'error']);
         }
     } elseif (Request::get('formname') == "nicForm") {
         /**
          *	Change the NIC
          *
          */
         $nic = Request::get('nic');
         if ($this->regex($nic, "NIC")) {
             $checkUser = user::where('nic', $nic)->count();
             if ($user->nic == $nic) {
                 return response()->json(['message' => 'NIC updated success!', 'code' => 'success']);
             } elseif ($checkUser > 0) {
                 return response()->json(['message' => 'NIC Already Taken', 'code' => 'error']);
             }
             $user->nic = $nic;
             $user->save();
             $this->updateSession();
             return response()->json(['message' => 'NIC updated success!', 'code' => 'success']);
         } else {
             return response()->json(['message' => 'Check your NIC!', 'code' => 'warning']);
         }
     } elseif (Request::get('formname') == "passwordForm") {
         /**
          *	Change the User Password
          *
          */
         $password = Request::get('password');
         if ($password != '') {
             $user->password = md5($password);
             $user->save();
             $this->updateSession();
             return response()->json(['message' => 'Passowrd updated success!', 'code' => 'success']);
         } else {
             return response()->json(['message' => 'Check your Passowrd!', 'code' => 'warning']);
         }
     } elseif (Request::get('formname') == "nameForm") {
         /**
          *	Change the User's Name
          *
          */
         $name = Request::get('name');
         if ($name != '') {
             $user->name = $name;
             $user->save();
             $this->updateSession();
             return response()->json(['message' => 'Name updated success!', 'code' => 'success']);
         } else {
             return response()->json(['message' => 'Check your Name!', 'code' => 'warning']);
         }
     } elseif (Request::get('formname') == "tpnoFormDoctor") {
         /**
          *	Change the Doctors working no
          *
          */
         $phoneNo = Request::get('tpnoWorking');
         $doctor = Session::get('doctor');
         if ($this->regex($phoneNo, "TP") || is_null($doctor)) {
             $doctor->phone = $phoneNo;
//.........这里部分代码省略.........
开发者ID:dprabhath,项目名称:SEP_WE_016,代码行数:101,代码来源:UserProfileController.php

示例11: descargarTodo

 public function descargarTodo()
 {
     /**
      * funcion de busqueda no regresa todos los campos y ocupa poner los provedores arraglar eso
      **/
     $busqueda = \App\productos::all();
     if (!count($busqueda) > 0) {
         $GLOBALS['results'] = collect(['Busqueda sin resultados']);
     }
     // dd($results);
     $archivo = Excel::create('Busqueda_911arq.com', function ($excel) {
         dd($excel);
         // Set the title
         $excel->setTitle('Productos');
         // Chain the setters
         $excel->setCreator('911arq.com')->setCompany('911arq.com');
         // Call them separately
         $excel->setDescription('Resultados de 911arq.com');
         //$GLOBALS['results']->groupBy('user_id');
         foreach ($busqueda->groupBy('user_id') as $productos) {
             // optiene la informacion del provedor
             $tienda = user::where('id', $productos[0]->user_id)->first();
             // crea la pagina y la llama con el nombre del provedor
             $excel->sheet($tienda->name, function ($sheet) use($productos, $tienda) {
                 $sheet->setOrientation('landscape');
                 // agrega 5 lineas a la pagina con la informacion del provedor y encabezados de columnas
                 // $sheet->appendRow(1,array($tienda->name));
                 dd($excel->sheet($tienda->name));
                 $sheet->rows(array(array($tienda->name), array($tienda->razon_social), array($tienda->direccion), array($tienda->telefono), array('----------------------RESULTADOS----------------------'), array('Producto', 'Precio', 'Codigo', 'Unidad')));
                 $contador = 0;
                 foreach ($productos as $producto) {
                     $sheet->appendRow(7 + $contador, array($producto->producto, $producto->precio, $producto->codigo, $producto->unidad));
                     $contador = $contador + 1;
                 }
             });
             //exel->sheet
         }
     })->download('xls');
     //  dd($archivo);
     //  $hoja =$archivo->sheet('Resultados');
     //$hoja->fromArray($results->toArray());
     //->fromArray($results->toArray());
     //dd($hoja);
     return redirect()->back();
 }
开发者ID:CrOnOs2k13,项目名称:911,代码行数:45,代码来源:Resultados.php

示例12: save_user_rekanan

 public function save_user_rekanan($id)
 {
     $data = Rekanan::find($id);
     $data->email_rkn = Input::get('username');
     $data->save();
     if (!empty(Input::get('password'))) {
         $password = Input::get('password');
         /*$user->password = Hash::make($password);
         		$user->get_pass = $password;*/
         $user = user::where('id_users', $id)->update(array('password' => Hash::make($password), 'username' => Input::get('username'), 'get_pass' => $password));
     } else {
         $user = user::where('id_users', $id)->update(array('username' => Input::get('username')));
     }
     if ($user > 0) {
         echo "ok";
     } else {
         echo "error";
     }
 }
开发者ID:komaltech,项目名称:RPPv2,代码行数:19,代码来源:RekananController.php


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