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


PHP User::find方法代码示例

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


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

示例1: register

 public function register()
 {
     $this->user = $this->Users->find('first', array('conditions' => array('User.email' => $this->facebookUser['email'])));
     if (!$this->user) {
         $this->createNewUser();
     } else {
         if ($this->user['User']['facebook_id'] != $this->facebookUser['id']) {
             $this->setFacebookId();
         }
     }
     $this->updatePhoto();
     $this->updateLoggedAt();
 }
开发者ID:slachiewicz,项目名称:_mojePanstwo-API-Server,代码行数:13,代码来源:FacebookRegistrationComponent.php

示例2: processILSUser

 private function processILSUser($info)
 {
     require_once ROOT_DIR . "/services/MyResearch/lib/User.php";
     $user = new User();
     //Marmot make sure we are using the username which is the
     //unique patron ID in Millennium.
     $user->username = $info['username'];
     if ($user->find(true)) {
         $insert = false;
     } else {
         //Do one more check based on the patron barcode in case we are converting
         //Clear username temporarily
         $user->username = null;
         global $configArray;
         $barcodeProperty = $configArray['Catalog']['barcodeProperty'];
         $user->{$barcodeProperty} = $info[$barcodeProperty];
         if ($user->find(true)) {
             $insert = false;
         } else {
             $insert = true;
         }
         //Restore username
         $user->username = $info['username'];
     }
     $user->password = $info['cat_password'];
     $user->firstname = $info['firstname'] == null ? " " : $info['firstname'];
     $user->lastname = $info['lastname'] == null ? " " : $info['lastname'];
     $user->cat_username = $info['cat_username'] == null ? " " : $info['cat_username'];
     $user->cat_password = $info['cat_password'] == null ? " " : $info['cat_password'];
     $user->email = $info['email'] == null ? " " : $info['email'];
     $user->major = $info['major'] == null ? " " : $info['major'];
     $user->college = $info['college'] == null ? " " : $info['college'];
     $user->patronType = $info['patronType'] == null ? " " : $info['patronType'];
     $user->web_note = $info['web_note'] == null ? " " : $info['web_note'];
     if (empty($user->displayName)) {
         if (strlen($user->firstname) >= 1) {
             $user->displayName = substr($user->firstname, 0, 1) . '. ' . $user->lastname;
         } else {
             $user->displayName = $user->lastname;
         }
     }
     if ($insert) {
         $user->created = date('Y-m-d');
         $user->insert();
     } else {
         $user->update();
     }
     return $user;
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:49,代码来源:ILSAuthentication.php

示例3: setUp

 public function setUp()
 {
     parent::setUp();
     Route::enableFilters();
     $user = User::find(1);
     $this->be($user);
 }
开发者ID:NorthPL,项目名称:Solder-for-NorthLauncher,代码行数:7,代码来源:BuildTest.php

示例4: get

 public function get()
 {
     $user_id = false;
     if (Auth::check()) {
         // Authenticating A User And "Remembering" Them
         Session::regenerate();
         $user_id = Auth::user()->id;
         if (Auth::user()->accountType == 1) {
             if (Session::has('admin_session')) {
                 Log::info("admin_session already created before - " . Session::get('admin_session'));
             } else {
                 Session::put('admin_session', $user_id);
                 Log::info("admin_session created");
             }
         }
         //            Log::info("Session cre8 - " . Session::get('admin_session'));
     }
     //        else if (Auth::viaRemember()) {
     //            // Determining If User Authed Via Remember
     //            $user_id = Auth::user()->id;
     //        }
     if (!$user_id) {
         $error_response = array('error' => array('message' => 'User not logged in.', 'type' => 'OAuthException', 'code' => 400));
         Log::info("User not logged in");
         return Response::json($error_response, 400)->setCallback(Input::get('callback'));
     }
     $user = User::find(Auth::user()->id);
     return Response::json($user)->setCallback(Input::get('callback'));
 }
开发者ID:andrewchng,项目名称:cSystem,代码行数:29,代码来源:AuthController.php

示例5: save

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function save()
 {
     $rules = ['firstname' => 'required', 'lastname' => 'required', 'login' => 'required', 'address' => 'required', 'cpassword' => 'required', 'npassword' => 'required', 'cnpassword' => 'required'];
     $validator = \Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('/settings')->withinput(Input::all())->withErrors($validator);
     } else {
         if (Input::get('npassword') == Input::get('cnpassword')) {
             // $u = User::select('*')->where('password',Hash::make(Input::get('cpassword')))->first();
             //return Hash::make(Input::get('cpassword'));
             //if(count($u)>0) {
             $user = User::find(Input::get('id'));
             $user->firstname = Input::get('firstname');
             $user->lastname = Input::get('lastname');
             //  $user->login = Input::get('login');
             $user->address = Input::get('address');
             // $user->email = Input::get('email');
             $user->password = Hash::make(Input::get('npassword'));
             $user->save();
             return Redirect::to('/settings')->with('success', 'Settings is changed please relogin the site.');
             /*}
               else
               {
                   $errorMessages = new Illuminate\Support\MessageBag;
                   $errorMessages->add('notmatch', 'Current Password did not match!');
                   return Redirect::to('/settings')->withErrors($errorMessages);
               }*/
         } else {
             $errorMessages = new Illuminate\Support\MessageBag();
             $errorMessages->add('notmatch', 'New Password and confirm password did not match!');
             return Redirect::to('/settings')->withErrors($errorMessages);
         }
     }
 }
开发者ID:hrshadhin,项目名称:school-management-system,代码行数:39,代码来源:settingsController.php

示例6: checkPermission

 public static function checkPermission($user, $post)
 {
     if ($post->deleted_at) {
         return false;
     }
     $friend = User::find($post->created_by);
     if (Auth::check()) {
         if ($post->created_by != $user->id) {
             switch ($post->privacy_level) {
                 case Post::_PRIVATE:
                     return false;
                     break;
                 case Post::_FRIEND:
                     $can_see = $user->friendship($friend);
                     if ($can_see == Friend::STRANGER) {
                         return false;
                     }
                     break;
                 case Post::_CUSTOM:
                     $can_see = DB::table('friend_post')->where('post_id', $post->id)->where('friend_id', Auth::user()->id)->first();
                     if (is_null($can_see)) {
                         return false;
                     }
                     break;
                 case Post::_PUBLIC:
                 default:
                     break;
             }
         }
     } else {
         return $post->privacy_level == Post::_PUBLIC;
     }
     return true;
 }
开发者ID:sh1nu11bi,项目名称:CloMa,代码行数:34,代码来源:PrivacyHelper.php

示例7: validate

 function validate()
 {
     if (!Session::has('vatsimauth')) {
         throw new AuthException('Session does not exist');
     }
     $SSO = new SSO(Config::get('vatsim.base'), Config::get('vatsim.key'), Config::get('vatsim.secret'), Config::get('vatsim.method'), Config::get('vatsim.cert'));
     $session = Session::get('vatsimauth');
     if (Input::get('oauth_token') !== $session['key']) {
         throw new AuthException('Returned token does not match');
         return;
     }
     if (!Input::has('oauth_verifier')) {
         throw new AuthException('No verification code provided');
     }
     $user = $SSO->checkLogin($session['key'], $session['secret'], Input::get('oauth_verifier'));
     if ($user) {
         Session::forget('vatsimauth');
         $authUser = User::find($user->user->id);
         if (is_null($authUser)) {
             $authUser = new User();
             $authUser->vatsim_id = $user->user->id;
             $authUser->name = trim($user->user->name_first . ' ' . $user->user->name_last);
         }
         $authUser->last_login = Carbon::now();
         $authUser->save();
         Auth::login($authUser);
         Messages::success('Welcome on board, <strong>' . $authUser->name . '</strong>!');
         return Redirect::intended('/');
     } else {
         $error = $SSO->error();
         throw new AuthException($error['message']);
     }
 }
开发者ID:T-SummerStudent,项目名称:new,代码行数:33,代码来源:AuthController.php

示例8: render_create_reporte_cn

 public function render_create_reporte_cn($id = null)
 {
     if (Auth::check()) {
         $data["inside_url"] = Config::get('app.inside_url');
         $data["user"] = Session::get('user');
         // Verifico si el usuario es un Webmaster
         if ($data["user"]->idrol == 1 || $data["user"]->idrol == 2 || $data["user"]->idrol == 3 || $data["user"]->idrol == 4) {
             $data["areas"] = Area::lists('nombre', 'idarea');
             $data["servicios"] = Servicio::lists('nombre', 'idservicio');
             $data["tipo_reporte_cn"] = TipoReporteCN::lists('nombre', 'idtipo_reporte_CN');
             $data["programaciones_reporte_cn"] = ProgramacionReporteCN::where('idestado_programacion_reportes', 1)->where('iduser', $data["user"]->id)->orwhere('idestado_programacion_reportes', 3)->lists('nombre_reporte', 'idprogramacion_reporte_cn');
             $data["programacion_reporte_cn_id"] = $id;
             $data["programacion_reporte_cn"] = null;
             $data["responsable"] = null;
             if ($id) {
                 $data["programacion_reporte_cn"] = ProgramacionReporteCN::where('idprogramacion_reporte_cn', '=', $id)->get()[0];
                 $data["responsable"] = User::find($data["programacion_reporte_cn"]->iduser);
             }
             $data["reporte_cn_info"] = null;
             return View::make('reportes_CN/createReportesCN', $data);
         } else {
             return View::make('error/error', $data);
         }
     } else {
         return View::make('error/error', $data);
     }
 }
开发者ID:ktakayama91,项目名称:GTSlaravel,代码行数:27,代码来源:ReporteCNController.php

示例9: listAction

 /**
  * List all users
  */
 public function listAction()
 {
     $users = User::find();
     foreach ($users as $user) {
         echo "{$user->email}\n";
     }
 }
开发者ID:stecman,项目名称:passnote,代码行数:10,代码来源:UsersTask.php

示例10: editAction

    /**
     * Exibe o form para edição de usuário.
     *
     * Exibe o form para editar o usuário a partir do ID passado pela URL
     * Se o usuário não existir é exibo uma mensagem de erro e não apresentamos
     * o form.
     *
     * @return void|false
     */
    public function editAction()
    {
        $id      = (int) $this->_getParam('id');
        $result  = $this->_model->find($id);
        $data    = $result->current();

        if ( null === $data )
        {
            $this->view->message = "Usu&aacute;rio n&atilde;o encontrado!";
            return false;
        }

        $form = new Application_Form_User();
        $form->setAsEditForm($data);

        if ( $this->_request->isPost() )
        {
            $data = array(
                'name'  => $this->_request->getPost('name'),
                'email' => $this->_request->getPost('email')
            );

            if ( $form->isValid($data) )
            {
                $this->_model->update($data, "id = $id");
                $this->_redirect('/users');
            }
        }

        $this->view->form = $form; 
    }
开发者ID:romulobonifacio,项目名称:blog-posts,代码行数:40,代码来源:UsersController.php

示例11: getShowWelcome

 public function getShowWelcome()
 {
     $user = User::find(1);
     $user->password = Hash::make('123');
     $user->save();
     return View::make('hello');
 }
开发者ID:armandolazarte,项目名称:cartera,代码行数:7,代码来源:HomeController.php

示例12: edit

 public function edit($id)
 {
     $data["_title"] = array("top" => "編輯使用者", "main" => "Home", "sub" => "user");
     $data["active"] = "users";
     $data["user"] = User::find($id);
     return View::make('admin.users.edit', $data);
 }
开发者ID:nvizero,项目名称:beautifulbuild,代码行数:7,代码来源:UserController.php

示例13: makePayment

 /**
  * Make a EWAY payment to the destined user from the main business account.
  *
  * @return void
  */
 protected function makePayment()
 {
     $receiver = Input::get('number');
     $amounttosend = Input::get('amount');
     $currency = Input::get('currency');
     $destinationProvider = Input::get('target');
     $charges = new PlatformCharges($amounttosend, $currency, $destinationProvider);
     $desc = $charges->getReceiverType($destinationProvider);
     $user = User::find(Auth::user()->id);
     $transaction = ['Customer' => ['FirstName' => Auth::user()->name, 'Street1' => 'Level 5', 'Country' => 'US', 'Mobile' => Auth::user()->number, 'Email' => Auth::user()->email], 'Items' => [['SKU' => mt_rand(), 'Description' => 'Hybrid Transfer from EWAY to ' . $desc . ' user', 'Quantity' => 1, 'UnitCost' => $charges->convertCurrency($currency, 'AUD', $charges->getDueAmount('ew', $destinationProvider)), 'Tax' => 100]], 'Options' => [['Value' => $desc], ['Value' => $receiver], ['Value' => 'AUD'], ['Value' => 0.01 * $amounttosend]], 'Payment' => ['TotalAmount' => $charges->convertCurrency($currency, 'AUD', $charges->getDueAmount('ew', $destinationProvider)) * 100, 'CurrencyCode' => 'AUD'], 'Method' => 'ProcessPayment', 'RedirectUrl' => URL::route('dashboard') . '/ewayconfirm', 'CancelUrl' => URL::route('dashboard') . '/ewaycancel', 'PartnerID' => EwayController::$_EWAY_CUSTOMER_ID, 'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE, 'Capture' => true, 'LogoUrl' => 'https://izepay.iceteck.com/public/images/logo.png', 'HeaderText' => 'Izepay Money Transfer', 'Language' => 'EN', 'CustomView' => 'BootstrapCerulean', 'VerifyCustomerEmail' => true, 'Capture' => true, 'CustomerReadOnly' => false];
     try {
         $response = $this->client->createTransaction(\Eway\Rapid\Enum\ApiMethod::RESPONSIVE_SHARED, $transaction);
         //var_dump($response);
         //                echo $response->SharedPaymentUrl;
         //sleep(20);
     } catch (Exception $ex) {
         return Redirect::route('dashboard')->with('alertError', 'Debug Error: ' . $ex->getMessage());
     }
     //manage response
     if (!$response->getErrors()) {
         // Redirect to the Responsive Shared Page
         header('Location: ' . $response->SharedPaymentUrl);
         //die();
     } else {
         foreach ($response->getErrors() as $error) {
             //echo "Response Error: ".\Eway\Rapid::getMessage($error)."<br>";
             return Redirect::route('dashboard')->with('alertError', 'Error! ' . \Eway\Rapid::getMessage($error));
         }
     }
 }
开发者ID:Roc4rdho,项目名称:app,代码行数:35,代码来源:EwayController.php

示例14: checkLine

 public function checkLine($line)
 {
     $errors = "";
     if (!FleximportTable::findOneByName("fleximport_semiro_course_import")) {
         return "Tabelle fleximport_semiro_course_import existiert nicht. ";
     }
     $dilp_kennung_feld = FleximportConfig::get("SEMIRO_DILP_KENNUNG_FIELD");
     if (!$dilp_kennung_feld) {
         $dilp_kennung_feld = "dilp_teilnehmer";
     }
     if (!$line[$dilp_kennung_feld]) {
         $errors .= "Teilnehmer hat keinen Wert für '{$dilp_kennung_feld}''. ";
     } else {
         $datafield = Datafield::findOneByName(FleximportConfig::get("SEMIRO_USER_DATAFIELD_NAME"));
         if (!$datafield) {
             $errors .= "System hat kein Datenfeld " . FleximportConfig::get("SEMIRO_USER_DATAFIELD_NAME") . ", womit die Nutzer identifiziert werden. ";
         } else {
             $entry = DatafieldEntryModel::findOneBySQL("datafield_id = ? AND content = ? ", array($datafield->getId(), $line[$dilp_kennung_feld]));
             if (!$entry || !User::find($entry['range_id'])) {
                 $errors .= "Nutzer konnte nicht durch id_teilnehmer identifiziert werden. ";
             }
         }
     }
     if (!$line['teilnehmergruppe']) {
         $errors .= "Keine Teilnehmergruppe. ";
     } else {
         $statement = DBManager::get()->prepare("\n                SELECT 1\n                FROM fleximport_semiro_course_import\n                WHERE teilnehmergruppe = ?\n            ");
         $statement->execute(array($line['teilnehmergruppe']));
         if (!$statement->fetch()) {
             $errors .= "Nicht verwendete Teilnehmergruppe. ";
         }
     }
     return $errors;
 }
开发者ID:Krassmus,项目名称:Fleximport,代码行数:34,代码来源:fleximport_semiro_participant_import.php

示例15: __construct

 /**
  * Get informations on depending selected user
  * @param String $current_user
  * @param String $user
  */
 function __construct($current_user, $user)
 {
     $this->current_user = User::find($current_user);
     $this->user = User::find($user);
     $this->visibilities = $this->getHomepageVisibilities();
     $this->perm = $GLOBALS['perm'];
 }
开发者ID:ratbird,项目名称:hope,代码行数:12,代码来源:ProfileModel.php


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