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


PHP Agent::get方法代码示例

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


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

示例1: getAgent

 public function getAgent()
 {
     $agent = Agent::get(['id' => $this->agent_id]);
     return $agent ? $agent[0] : null;
 }
开发者ID:superflyz,项目名称:wallfly-mvc,代码行数:5,代码来源:Property.php

示例2: login

 public function login()
 {
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         // check user type
         if ($_POST['usertype'] === 'owner') {
             // if owner
             $owner = Owner::get(['email' => $_POST['email']])[0];
             if ($owner) {
                 // check the password
                 if (validate_password($_POST['password'], $owner->password)) {
                     // password matched
                     $_SESSION['usertype'] = USERTYPE_OWNER;
                     $_SESSION['user'] = $owner;
                 } else {
                     // wrong password
                     Flash::set('error_message', 'Wrong email or password');
                 }
             } else {
                 // cannot find the user with the email
                 Flash::set('error_message', 'Wrong email or password');
             }
         } elseif ($_POST['usertype'] === 'tenant') {
             $tenant = Tenant::get(['email' => $_POST['email']])[0];
             if ($tenant) {
                 // check the password
                 if (validate_password($_POST['password'], $tenant->password)) {
                     // password matched
                     $_SESSION['usertype'] = USERTYPE_TENANT;
                     $_SESSION['user'] = $tenant;
                 } else {
                     // wrong password
                     Flash::set('error_message', 'Wrong email or password');
                 }
             } else {
                 // cannot find the user with the email
                 Flash::set('error_message', 'Wrong email or password');
             }
         } elseif ($_POST['usertype'] === 'agent') {
             $agent = Agent::get(['email' => $_POST['email']])[0];
             if ($agent) {
                 // check the password
                 if (validate_password($_POST['password'], $agent->password)) {
                     // password matched
                     $_SESSION['usertype'] = USERTYPE_AGENT;
                     $_SESSION['user'] = $agent;
                 } else {
                     // wrong password
                     Flash::set('error_message', 'Wrong email or password');
                 }
             } else {
                 // cannot find the user with the email
                 Flash::set('error_message', 'Wrong email or password');
             }
         } elseif ($_POST['usertype'] === 'real_estate') {
             // if real estate
             $realestate = Real_Estate::get(['name' => $_POST['name']])[0];
             if ($realestate) {
                 // check password
                 if (validate_password($_POST['password'], $realestate->password)) {
                     $_SESSION['usertype'] = USERTYPE_REALESTATE;
                     $_SESSION['user'] = $realestate;
                 } else {
                     // wrong password
                     Flash::set('error_message', 'Wrong password');
                 }
             }
         }
     }
     $this->redirect('/');
 }
开发者ID:superflyz,项目名称:wallfly-mvc,代码行数:70,代码来源:Home.php


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