本文整理汇总了PHP中Account::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::create方法的具体用法?PHP Account::create怎么用?PHP Account::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUpdateAdditionalOwners
public function testUpdateAdditionalOwners()
{
$response = $this->managedAccountResponse('acct_ABC');
$this->mockRequest('POST', '/v1/accounts', array('managed' => 'true'), $response);
$response['legal_entity']['additional_owners'] = array(array('first_name' => 'Bob', 'last_name' => null, 'address' => array('line1' => null, 'line2' => null, 'city' => null, 'state' => null, 'postal_code' => null, 'country' => null), 'verification' => array('status' => 'unverified', 'document' => null, 'details' => null)));
$this->mockRequest('POST', '/v1/accounts/acct_ABC', array('legal_entity' => array('additional_owners' => array(array('first_name' => 'Bob')))), $response);
$response['legal_entity']['additional_owners'][0]['last_name'] = 'Smith';
$this->mockRequest('POST', '/v1/accounts/acct_ABC', array('legal_entity' => array('additional_owners' => array(array('last_name' => 'Smith')))), $response);
$response['legal_entity']['additional_owners'][0]['last_name'] = 'Johnson';
$this->mockRequest('POST', '/v1/accounts/acct_ABC', array('legal_entity' => array('additional_owners' => array(array('last_name' => 'Johnson')))), $response);
$response['legal_entity']['additional_owners'][0]['verification']['document'] = 'file_123';
$this->mockRequest('POST', '/v1/accounts/acct_ABC', array('legal_entity' => array('additional_owners' => array(array('verification' => array('document' => 'file_123'))))), $response);
$response['legal_entity']['additional_owners'][1] = array('first_name' => 'Jane', 'last_name' => 'Doe');
$this->mockRequest('POST', '/v1/accounts/acct_ABC', array('legal_entity' => array('additional_owners' => array(1 => array('first_name' => 'Jane')))), $response);
$account = Account::create(array('managed' => true));
$account->legal_entity->additional_owners = array(array('first_name' => 'Bob'));
$account->save();
$this->assertSame(1, count($account->legal_entity->additional_owners));
$this->assertSame('Bob', $account->legal_entity->additional_owners[0]->first_name);
$account->legal_entity->additional_owners[0]->last_name = 'Smith';
$account->save();
$this->assertSame(1, count($account->legal_entity->additional_owners));
$this->assertSame('Smith', $account->legal_entity->additional_owners[0]->last_name);
$account['legal_entity']['additional_owners'][0]['last_name'] = 'Johnson';
$account->save();
$this->assertSame(1, count($account->legal_entity->additional_owners));
$this->assertSame('Johnson', $account->legal_entity->additional_owners[0]->last_name);
$account->legal_entity->additional_owners[0]->verification->document = 'file_123';
$account->save();
$this->assertSame('file_123', $account->legal_entity->additional_owners[0]->verification->document);
$account->legal_entity->additional_owners[1] = array('first_name' => 'Jane');
$account->save();
$this->assertSame('Jane', $account->legal_entity->additional_owners[1]->first_name);
}
示例2: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Account::create([]);
}
}
示例3: add
public function add()
{
$param = Input::all();
$emp_id = Employee::where('ssn', '=', $param['ssn'])->pluck('id');
Account::create(array('username' => $param['username'], 'password' => Hash::make($param['password']), 'employee_id' => $emp_id, 'role_id' => $param['role']));
return Response::json(array('valid' => TRUE));
}
示例4: testCreateAccount
public function testCreateAccount()
{
Client::relateIQ(GlobalVar::KEY, GlobalVar::SECRET);
$account = new Account(['name' => 'Account4']);
$res = $account->create();
$this->assertInstanceOf('Account', $res);
$this->assertEquals('Account4', $res->name());
}
示例5: run
public function run()
{
$account_fake1 = array('email' => 'administrator@guia-apir.com', 'password' => Hash::make('GuiaApir1234'), 'role_id' => '1', 'activated' => true);
$account_fake2 = array('email' => 'specialist@guia-apir.com', 'password' => Hash::make('GuiaApir1234'), 'age' => '21', 'referee_number' => '123456789', 'role_id' => '2', 'gender_id' => '1', 'province_id' => '9', 'specialty_id' => '2', 'activated' => true);
$account_fake3 = array('email' => 'temporal@temporal', 'password' => Hash::make('GuiaApir1234'), 'role_id' => '3', 'activated' => true);
Account::create($account_fake1);
Account::create($account_fake2);
Account::create($account_fake3);
}
示例6: run
public function run()
{
$faker = $this->getFaker();
for ($i = 0; $i < 10; $i++) {
$email = $faker->email;
$password = Hash::make("password");
Account::create(["email" => $email, "password" => $password]);
}
}
示例7: store
/**
* Store a newly created account in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Account::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
Account::create($data);
return Redirect::route('accounts.index');
}
示例8: post_index
public function post_index()
{
if (!AccountForm::is_valid()) {
return Redirect::back()->with_input()->with_errors(AccountForm::$validation);
}
$new_account = Account::create(Input::get());
if ($new_account) {
return Redirect::to_action('accounts');
}
}
示例9: stAccount
public function stAccount()
{
$account_id = $this->st_account;
if (empty($account_id)) {
$account = Account::create();
$this->edit('st_account', $account->id);
return $account;
}
return new Account($this->st_account);
}
示例10: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$input = Input::all();
$input['user_id'] = Auth::user()->id;
$input['account'] = md5(Auth::user()->getFullName() . time());
$input['token'] = md5($input['account'] . json_encode(Input::all()));
$validation = Validator::make($input, Account::$rules);
if ($validation->passes()) {
Account::create($input);
return Redirect::route('accounts.index');
}
return Redirect::route('accounts.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.');
}
示例11: testUpdateAdditionalOwners
public function testUpdateAdditionalOwners()
{
self::authorizeFromEnv();
$d = Account::create(array('managed' => true));
$id = $d->id;
$d->legal_entity->additional_owners = array(array('first_name' => 'Bob'));
$d->save();
$d = Account::retrieve($id);
$this->assertSame(1, count($d->legal_entity->additional_owners));
$this->assertSame('Bob', $d->legal_entity->additional_owners[0]->first_name);
$d->legal_entity->additional_owners[0]->last_name = 'Smith';
$d->save();
$d = Account::retrieve($id);
$this->assertSame(1, count($d->legal_entity->additional_owners));
$this->assertSame('Smith', $d->legal_entity->additional_owners[0]->last_name);
}
示例12: create
protected function create(array $params)
{
$smarty = SmailSmarty::getInstance();
$smarty->setTemplate('login.tpl');
if (!(isset($params['name']) && isset($params['password']) && isset($params['confirm']))) {
$smarty->assign('CREATE_ERRORS', 1);
} elseif ($params['password'] != $params['confirm']) {
$smarty->assign('CREATE_ERRORS', 2);
} else {
$account = new Account($params['name'], $params['password']);
if (!$account->exists()) {
if ($account->create()) {
$_SESSION['account'] = $account->getName();
header('Location: ' . WEBDIR . 'Profil');
}
} else {
$smarty->setTemplate('login.tpl');
$smarty->assign('CREATE_ERRORS', 3);
}
}
}
示例13: createAccountsFromAttributes
private function createAccountsFromAttributes($attributes, $orders=array(), $ordertasks=array(), $purchases=array()){
$data = \Account::create($attributes);
if(is_null($data)) return;
if($this->isordridauto){
$this->updateLastId($data->type, $data->acnt_no);
}
if($data->accounttype === Menu::acc_type_receivables){
$this->saveAccountOrders($orders, $data->id);
}else{
$this->saveAccountOrdertasks($ordertasks, $data->id);
$this->saveAccountPurchases($purchases, $data->id);
}
}
示例14: create_accounts
/**
* prepare test accounts
*/
public static function create_accounts()
{
// Create admin account
// First account is always admin
if (!Account::exists("testadmin")) {
if (!Account::create("testadmin", "testadminpassword", "testadminpassword")) {
throw new Exception("Cannot create admin account");
}
}
// Create normal account
if (!Account::exists("testuser")) {
if (!Account::create("testuser", "testpassword", "testpassword")) {
throw new Exception("Cannot create testuser account");
}
}
}
示例15: testCreate
public function testCreate()
{
// row to create
$values = array('id' => 1, 'name' => 'Joe', 'amount' => 100);
// our mock adapter
$adapter = $this->adapterMock;
// prepare the mock to expect the variables passed, and return a row
$adapter->expects($this->once())->method('insert')->with('accounts', $values)->will($this->returnValue(true));
$accountsTable = new Account($adapter);
// getInstance doesn't work well in testing
$result = $accountsTable->create($values);
$this->assertTrue($result);
}