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


PHP Owner::create方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  * POST /owners
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $v = Validator::make(Input::All(), array('name' => 'required', 'lname' => 'required', 'phone' => 'required|max:16|min:10', 'email' => 'required|email|unique:owners'));
     if ($v->passes()) {
         Owner::create($input);
         return Redirect::intended('admin/owner');
     }
     return Redirect::back()->withInput()->withErrors($v)->with('message', 'There were validation errors');
 }
开发者ID:jeremiteki,项目名称:mteja,代码行数:16,代码来源:OwnersController.php

示例2: run

 public function run()
 {
     Owner::create(array('name' => 'San Jose State University', 'phone_number' => '408-924-1000', 'email_address' => 'admin@sjsu.edu'));
     Owner::create(array('name' => 'Public', 'phone_number' => '', 'email_address' => ''));
     // Uncomment to use Faker
     /*$faker = Faker::create();
     
           for ($i = 0; $i < 10; $i++) {
              Owner::create(array(
                 'name'          => $faker->name,
                 'phone_number'  => $faker->phoneNumber,
                 'email_address' => $faker->email
              ));
           }*/
 }
开发者ID:kr85,项目名称:SpartaPark,代码行数:15,代码来源:OwnersTableSeeder.php

示例3: createOwners

 /**
  *
  */
 protected function createOwners()
 {
     Owner::create(['idnum' => 1, 'email' => 'john@doe.com']);
     Owner::create(['idnum' => 2, 'email' => 'jane@doe.com']);
 }
开发者ID:tshafer,项目名称:laravel-ownable,代码行数:8,代码来源:OwnableTest.php

示例4: submit

 public function submit()
 {
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         // 1. validate post data
         $validcheck = Validator::validate_owner_data($_POST);
         // 2. check if valid
         if (!$validcheck['valid']) {
             // 3a. if not, check the error code, handle each error accordingly
             if ($validcheck['error_code'] === ERROR_PASSWORDS_NOT_MATCH) {
                 // password & password_repeat are different
                 // TODO: handle the error
                 Flash::set('error_message', 'Passwords did not match');
             } elseif ($validcheck['error_code'] === ERROR_EMPTY) {
                 // one of the fields left blank
                 // TODO: handle the error
                 Flash::set('error_message', "Data required: {$validcheck['field']}");
             } elseif ($validcheck['error_code'] === ERROR_NAME_CONTAINS_NUMERIC) {
                 // either firstname or lastname contains numeric
                 // TODO: handle the error
                 Flash::set('error_messsage', "{$validcheck['field']} cannot contain numeric");
             } elseif ($validcheck['error_code'] === ERROR_EMAIL_NOT_IN_PROPER_FORMAT) {
                 // email address doesn't pass the filter_var($var, FILTER_VALIDATE_EMAIL) function
                 // TODO: handle the error
                 Flash::set('error_message', "Please enter valid email address");
             } elseif ($validcheck['error_code'] === ERROR_PHONE_NOT_IN_PROPER_FORMAT) {
                 // phone number contains character that is not numeric
                 // TODO: handle the error
                 Flash::set('error_message', "Please enter valid phone number");
             } elseif ($validcheck['error_code'] === ERROR_PASSWORD_LESS_THAN_EIGHT_CHARS) {
                 // password is less than 8 characters
                 Flash::set('error_message', 'Your password should have at least 8 characters');
             } elseif ($validcheck['error_code'] === ERROR_PASSWORD_NOT_CONTAIN_ANY_NUMERIC) {
                 // password does not contain any numerics
                 Flash::set('error_message', 'Your password should have at least 1 numerical character');
             } elseif ($validcheck['error_code'] === ERROR_PASSWORD_NOT_CONTAIN_ANY_CAPITAL) {
                 // password does not contain any capital letters
                 Flash::set('error_message', 'Your password should have at least 1 capital letter');
             } elseif ($validcheck['error_code'] === ERROR_PASSWORD_NOT_CONTAIN_ANY_LOWERCASE) {
                 // password does not contain any lowercase letters
                 Flash::set('error_message', 'Your password should have at least 1 lowercase letter');
             } else {
                 // unknown error
                 // TODO: handle the error
                 Flash::set('error_message', 'Your application could not be processed, please try again later');
             }
             $this->redirect('/');
         } else {
             // TODO: hash password
             $hashed = create_hash($_POST['password']);
             // TODO: store in database
             Owner::create(['email' => $_POST['email'], 'password' => $hashed, 'firstname' => $_POST['first_name'], 'lastname' => $_POST['last_name'], 'phone' => $_POST['phone'], 'photo' => 'img/dummy_profile_picture.jpg']);
             Flash::set('success_message', 'Your account has been created, you can now ');
             $this->redirect('/');
         }
     } else {
         $this->redirect('/');
     }
 }
开发者ID:superflyz,项目名称:wallfly-mvc,代码行数:58,代码来源:PropertyOwner.php


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