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


PHP Customer::create方法代码示例

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


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

示例1: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Customer::create([]);
     }
 }
开发者ID:yanguanglan,项目名称:sz,代码行数:7,代码来源:CustomersTableSeeder.php

示例2: run

 public function run()
 {
     DB::table('customers')->delete();
     Customer::create(array('name' => 'customerA', 'street' => '123 Main', 'city' => 'Denver', 'state' => 'CO', 'zipcode' => '80204', 'home_phone' => '303-555-1212', 'work_phone' => '303-555-2345', 'email' => 'customerA@example.com'));
     Customer::create(array('name' => 'customerB', 'street' => '123 Elm', 'city' => 'Louisville', 'state' => 'CO', 'zipcode' => '80027', 'home_phone' => '303-555-1212', 'work_phone' => '303-555-2345', 'email' => 'customerB@example.com'));
     Customer::create(array('name' => 'customerC', 'street' => '123 Broadway', 'city' => 'Boulder', 'state' => 'CO', 'zipcode' => '80304', 'home_phone' => '303-555-1212', 'work_phone' => '303-555-2345', 'email' => 'customerC@example.com'));
 }
开发者ID:UniquelySimilar,项目名称:order_mgmt_laravel,代码行数:7,代码来源:CustomerTableSeeder.php

示例3: store

 /**
  * Store a newly created resource in storage.
  * POST /customers
  *
  * @return Response
  */
 public function store()
 {
     $customer = Input::all();
     $contact = array_pull($customer, 'contactInfo');
     $numbers = array_pull($contact, 'number');
     $numberTypes = array_pull($contact, 'number_type');
     $customerRules = array('name' => 'required', 'industry_type' => 'required');
     $contactRules = array('email' => 'required|email');
     $customerValidator = Validator::make($customer, $customerRules);
     $contactValidator = Validator::make($contact, $contactRules);
     if ($customerValidator->fails()) {
         return Redirect::back()->withErrors($customerValidator)->withInput(Input::all());
     }
     if ($contactValidator->fails()) {
         return Redirect::back()->withErrors($contactValidator)->withInput(Input::all());
     }
     // Add Customer
     $newCustomer = Customer::create($customer);
     foreach ($numbers as $index => $number) {
         $contactNumbers[] = new ContactNumber(['number' => $number, 'type' => $numberTypes[$index]]);
     }
     $contactInfo = ContactInfo::create($contact);
     $contactInfo->contactNumbers()->saveMany($contactNumbers);
     // Attach Address
     $newCustomer->contactInfo()->save($contactInfo);
     return Redirect::route('customers.create.representative', ['id' => $newCustomer->id])->with('message', 'Successfully added customer')->with('alert-class', 'success');
 }
开发者ID:razerbite,项目名称:frisco_foundry,代码行数:33,代码来源:CustomersController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  * POST /customers
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Customer::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $image_fields = $this->image_fields;
     $pic_destination = $this->upload_folder;
     $files = array();
     for ($i = 0; $i < count($image_fields); $i++) {
         $files[$i] = Input::file($image_fields[$i]);
         if ($files[$i]) {
             $pic_extension = $files[$i]->getClientOriginalExtension();
             $pic_name = md5(date("Y-m-d H:i:s") . rand(11111, 99999)) . '.' . $pic_extension;
             $upload = $files[$i]->move($pic_destination, $pic_name);
             $data[$image_fields[$i]] = $pic_name;
         } else {
             $data[$image_fields[$i]] = '';
         }
     }
     $data['created_by'] = Auth::user()->id;
     $data['changed_by'] = Auth::user()->id;
     Customer::create($data);
     return Redirect::route('admin.customers.index');
 }
开发者ID:syafdia,项目名称:PAS,代码行数:31,代码来源:CustomersController.php

示例5: testCustomerCreateWithoutCardParams

 /**
  * @group ecommerce
  */
 public function testCustomerCreateWithoutCardParams()
 {
     $this->mockResponse($this->failed_customer_create_response2());
     $response = Customer::create(array());
     $this->assertObjectHasAttribute('error', $response);
     $this->assertEquals($response->error->code, 20001);
 }
开发者ID:everypay,项目名称:everypay-php,代码行数:10,代码来源:CustomerTest.php

示例6: testCustomerCreate

 public function testCustomerCreate()
 {
     $params = array('card_number' => '4111111111111111', 'expiration_month' => '01', 'expiration_year' => date('Y') + 1, 'cvv' => '123', 'holder_name' => 'John Doe');
     $this->mockResponse($this->success_customer_create_response());
     $customer = Customer::create($params);
     $this->assertTrue($customer->is_active);
     $this->assertNotNull($customer->token);
 }
开发者ID:everypay,项目名称:everypay_prestashop_1_4_x,代码行数:8,代码来源:CustomerTest.php

示例7: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         $user_id = rand(1, 10);
         Customer::create(['name' => $faker->name(), 'address' => $faker->address(), 'sex' => rand(0, 1), 'no_ktp' => rand(1111111111, 9999999999), 'no_npwp' => rand(1111111111, 9999999999), 'scanned_ktp' => rand(1111111111, 9999999999) . 'ktp', 'scanned_npwp' => rand(1111111111, 9999999999) . 'npwp', 'scanned_kk' => rand(1111111111, 9999999999) . 'kk', 'created_by' => $user_id, 'changed_by' => $user_id, 'change_reason' => $faker->realText(100)]);
     }
 }
开发者ID:syafdia,项目名称:PAS,代码行数:8,代码来源:CustomersTableSeeder.php

示例8: testInvalidCredentials

 public function testInvalidCredentials()
 {
     Stripe::setApiKey('invalid');
     try {
         Customer::create();
     } catch (Error\Authentication $e) {
         $this->assertSame(401, $e->getHttpStatus());
     }
 }
开发者ID:BenComicGraphics,项目名称:stripe-php,代码行数:9,代码来源:AuthenticationErrorTest.php

示例9: contact

 public function contact()
 {
     $input = Input::except('_token');
     $id = Customer::create($input)->id;
     if ($id) {
         return Redirect::action('ContactController@index')->with('message', 'Đã gửi thành công');
     }
     return Redirect::action('ContactController@index')->with('message', 'Gửi thất bại');
 }
开发者ID:trantung,项目名称:company,代码行数:9,代码来源:ContactController.php

示例10: addCustomer

 public function addCustomer($info)
 {
     $cus = Customer::create(array_merge($info, array('adopted' => 1)));
     $addr = $cus->defaultAddress();
     extract($info);
     if ($realname || $phone || $address) {
         $addr->edit(array('name' => $realname, 'phone' => $phone, 'detail' => $address));
     }
 }
开发者ID:name3,项目名称:cheng,代码行数:9,代码来源:Admin.php

示例11: store

 /**
  * Store a newly created customer in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Customer::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     Customer::create($data);
     return Redirect::back()->with('message', 'berhasil lolisimo!');
 }
开发者ID:shittyc0de,项目名称:AplikasiLC,代码行数:14,代码来源:CustomersController.php

示例12: store

 /**
  * Store a newly created product in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make(Input::all(), Customer::$rules);
     if ($validator->passes()) {
         Customer::create(Input::all());
         return Response::json(array('success' => true, 'message' => array('type' => 'success', 'msg' => 'Thêm khách hàng thành công!')));
     } else {
         return Response::json(array('success' => false, 'errors' => $validator->errors()));
     }
 }
开发者ID:jimmyhien,项目名称:dailyhuuhoc,代码行数:15,代码来源:CustomersController.php

示例13: testVerify

 public function testVerify()
 {
     self::authorizeFromEnv();
     $bankAccountToken = Token::create(array('bank_account' => array('country' => 'US', 'routing_number' => '110000000', 'account_number' => '000123456789', 'name' => 'Jane Austen', 'account_holder_type' => 'company')));
     $customer = Customer::create();
     $externalAccount = $customer->sources->create(array('bank_account' => $bankAccountToken->id));
     $verifiedAccount = $externalAccount->verify(array('amounts' => array(32, 45)), null);
     $base = Customer::classUrl();
     $parentExtn = $externalAccount['customer'];
     $extn = $externalAccount['id'];
     $this->assertEquals("{$base}/{$parentExtn}/sources/{$extn}", $externalAccount->instanceUrl());
 }
开发者ID:BenComicGraphics,项目名称:stripe-php,代码行数:12,代码来源:ExternalAccountTest.php

示例14: create

 public function create()
 {
     // Validation
     $input = Input::all();
     try {
         $validate_data = $this->_validator->validate($input);
     } catch (ValidationException $e) {
         return Redirect::route('new_customer_path')->withInput()->withErrors($e->get_errors());
     }
     // Creation
     $customer = Customer::create($input);
     return Redirect::route('show_customer_path', array($customer['id']))->with('success', 'Customer created.');
 }
开发者ID:UniquelySimilar,项目名称:order_mgmt_laravel,代码行数:13,代码来源:CustomerController.php

示例15: run

 public function run()
 {
     $customers = array(array('last_name' => 'Jones', 'first_name' => 'Tim', 'telephone1' => '(918) 555 1212', 'email' => 'tdjones@example.com', 'password' => Hash::make('password'), 'admin_ind' => TRUE), array('last_name' => 'User', 'first_name' => 'Joe', 'telephone1' => '(918) 555 1212', 'email' => 'joe@example.com', 'password' => Hash::make('password'), 'admin_ind' => FALSE), array('last_name' => 'vincent', 'first_name' => 'jan michael', 'telephone1' => '(918) 555 7890', 'email' => 'jmvincent@example.com', 'password' => Hash::make('password'), 'admin_ind' => FALSE));
     $addresses = array(array('addr1' => '123 My Street', 'city' => 'Owasso', 'state' => 'OK', 'postal_code' => '74055', 'country' => 'USA'), array('addr1' => '123 Joe\'s Street', 'city' => 'Owasso', 'state' => 'OK', 'postal_code' => '74055', 'country' => 'USA'), array('addr1' => '456 Oak Street', 'city' => 'Tulsa', 'state' => 'OK', 'postal_code' => '74102', 'country' => 'USA'), array('addr1' => '888 Yellow Lane', 'addr2' => 'c/o Sacramento Church of Christ', 'city' => 'Sacramento', 'state' => 'CA', 'postal_code' => '99999', 'country' => 'USA'));
     foreach ($customers as $customer) {
         $customer['password_confirmation'] = $customer['password'];
         $newcust = Customer::create($customer);
         //var_dump($customer);
         // Choose a random address from the list and insert it for the new customer.
         $address = $addresses[mt_rand(0, count($addresses) - 1)];
         $address['customer_id'] = $newcust->id;
         Address::create($address);
     }
 }
开发者ID:marciocamello,项目名称:laravel-ecommerce,代码行数:14,代码来源:CustomersTableSeeder.php


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