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


PHP Customer::getUsername方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $validator = \Validator::make($request->all(), ['email' => 'required|unique:customers,email', 'firstname' => 'required']);
     if ($validator->fails()) {
         return response()->json(array('status' => 500, 'monolog' => array('title' => 'errors', 'message' => implode($validator->errors()->all(), '<br>'))));
     }
     $customer = new Customer();
     $customer->username = $customer->getUsername($request->firstname);
     $customer->email = $request->email;
     // pass: kibarer // $2y$10$STb5v6UVqr7ZxGj2ixQvseLTpW14aYUiIdKtyUrESkXCh6EAmmXju
     $customer->password = \Hash::make($request->password);
     // $customer->remember_token = $request->remember_token;
     // $customer->confirmation_code = $request->confirmation_code;
     // $customer->confirmed = $request->confirmed;
     $customer->firstname = $request->firstname;
     $customer->lastname = $request->lastname;
     $customer->address = $request->address;
     $customer->phone = $request->phone;
     // find province, country
     $city = \App\City::where('city_name', $request->city)->first();
     $customer->city = $request->city;
     $customer->province = $city->province->province_name;
     $customer->country = $city->province->country->nicename;
     $customer->zipcode = $request->zipcode;
     $customer->facebook = $request->facebook;
     $customer->twitter = $request->twitter;
     // $customer->image_profile = $request->image_profile;
     $customer->newsletter = 1;
     $customer->active = 1;
     $customer->save();
     return response()->json(array('status' => 200, 'monolog' => array('title' => 'success', 'message' => 'object has been saved')));
 }
开发者ID:borislemke,项目名称:kbr,代码行数:39,代码来源:CustomerController.php

示例2: postRegister

 public function postRegister(Request $request)
 {
     $validator = \Validator::make($request->all(), ['email' => 'required|unique:customers', 'password' => 'required|confirmed', 'firstname' => 'required', 'city' => 'required', 'g-recaptcha-response' => 'required']);
     if ($validator->fails()) {
         return response()->json(array('status' => 500, 'monolog' => array('title' => 'errors', 'message' => $validator->errors())));
     }
     $confirmation_code = str_random(30);
     $customer = new Customer();
     $customer->username = $customer->getUsername($request->firstname);
     $customer->email = $request->email;
     $customer->password = \Hash::make($request->password);
     $customer->firstname = $request->firstname;
     $customer->lastname = $request->lastname;
     $customer->address = $request->address;
     // find province, country
     $city = \App\City::where('city_name', $request->city)->first();
     $customer->city = $request->city;
     $customer->province = $city->province->province_name;
     $customer->country = $city->province->country->name;
     $customer->confirmation_code = $confirmation_code;
     $customer->save();
     // send confirm email
     $this->sendConfirmationEmail($customer->firstname, $customer->email, $confirmation_code);
     // $request->session()->flash('alert-success', 'Thankyou for registration. Please check your email address to activate your account.');
     return response()->json(array('status' => 200, 'monolog' => array('title' => 'success', 'message' => 'Thanks for registration. Please check your email to activate your account.')));
 }
开发者ID:borislemke,项目名称:kbr,代码行数:26,代码来源:AuthController.php

示例3: postRegister

 public function postRegister(Request $request)
 {
     $this->validate($request, ['email' => 'required|unique:Customers', 'password' => 'required|confirmed', 'firstname' => 'required', 'city' => 'required']);
     $confirmation_code = str_random(30);
     $customer = new Customer();
     $customer->username = $customer->getUsername($request->firstname);
     $customer->email = $request->email;
     $customer->password = \Hash::make($request->password);
     $customer->firstname = $request->firstname;
     $customer->lastname = $request->lastname;
     $customer->address = $request->address;
     // find province, country
     $city = \App\City::where('city_name', $request->city)->first();
     $customer->city = $request->city;
     $customer->province = $city->province->province_name;
     $customer->country = $city->province->country->nicename;
     $customer->confirmation_code = $confirmation_code;
     $customer->save();
     // send confirm email
     $this->sendConfirmationEmail($customer->email, $confirmation_code);
     $request->session()->flash('alert-success', 'Thankyou for registration. Please check your email address to activate your account.');
     return redirect()->back();
 }
开发者ID:candrasetiadi,项目名称:nvjvnjsdnnvdvdw,代码行数:23,代码来源:AuthController.php


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