本文整理汇总了PHP中app\models\Account::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::create方法的具体用法?PHP Account::create怎么用?PHP Account::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Account
的用法示例。
在下文中一共展示了Account::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$this->command->info('Running UserTableSeeder');
Eloquent::unguard();
$account = Account::create(['name' => 'Test Account', 'account_key' => str_random(16), 'timezone_id' => 1]);
User::create(['email' => TEST_USERNAME, 'username' => TEST_USERNAME, 'account_id' => $account->id, 'password' => Hash::make(TEST_PASSWORD)]);
}
示例2: run
public function run()
{
$this->command->info('Running UserTableSeeder');
Eloquent::unguard();
$account = Account::create(['name' => 'Test Account', 'account_key' => str_random(16), 'timezone_id' => 1]);
User::create(['email' => TEST_USERNAME, 'username' => TEST_USERNAME, 'account_id' => $account->id, 'password' => Hash::make(TEST_PASSWORD), 'registered' => true, 'confirmed' => true]);
Affiliate::create(['affiliate_key' => SELF_HOST_AFFILIATE_KEY]);
}
示例3: run
public function run()
{
$this->command->info('Running UserTableSeeder');
Eloquent::unguard();
$faker = Faker\Factory::create();
$company = Company::create();
$account = Account::create(['name' => $faker->name, 'address1' => $faker->streetAddress, 'address2' => $faker->secondaryAddress, 'city' => $faker->city, 'state' => $faker->state, 'postal_code' => $faker->postcode, 'country_id' => Country::all()->random()->id, 'account_key' => str_random(RANDOM_KEY_LENGTH), 'invoice_terms' => $faker->text($faker->numberBetween(50, 300)), 'work_phone' => $faker->phoneNumber, 'work_email' => $faker->safeEmail, 'invoice_design_id' => min(InvoiceDesign::all()->random()->id, 10), 'header_font_id' => min(Font::all()->random()->id, 17), 'body_font_id' => min(Font::all()->random()->id, 17), 'primary_color' => $faker->hexcolor, 'timezone_id' => 1, 'company_id' => $company->id]);
User::create(['email' => TEST_USERNAME, 'username' => TEST_USERNAME, 'account_id' => $account->id, 'password' => Hash::make(TEST_PASSWORD), 'registered' => true, 'confirmed' => true, 'notify_sent' => false, 'notify_paid' => false]);
Affiliate::create(['affiliate_key' => SELF_HOST_AFFILIATE_KEY]);
}
示例4: run
public function run()
{
$this->command->info('Running UserTableSeeder');
Eloquent::unguard();
$faker = Faker\Factory::create();
$company = Company::create();
$account = Account::create(['name' => $faker->name, 'address1' => $faker->streetAddress, 'address2' => $faker->secondaryAddress, 'city' => $faker->city, 'state' => $faker->state, 'postal_code' => $faker->postcode, 'country_id' => Country::all()->random()->id, 'account_key' => str_random(RANDOM_KEY_LENGTH), 'invoice_terms' => $faker->text($faker->numberBetween(50, 300)), 'work_phone' => $faker->phoneNumber, 'work_email' => $faker->safeEmail, 'invoice_design_id' => InvoiceDesign::where('id', '<', CUSTOM_DESIGN)->get()->random()->id, 'header_font_id' => min(Font::all()->random()->id, 17), 'body_font_id' => min(Font::all()->random()->id, 17), 'primary_color' => $faker->hexcolor, 'timezone_id' => 1, 'company_id' => $company->id]);
$user = User::create(['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => TEST_USERNAME, 'username' => TEST_USERNAME, 'account_id' => $account->id, 'password' => Hash::make(TEST_PASSWORD), 'registered' => true, 'confirmed' => true, 'notify_sent' => false, 'notify_paid' => false, 'is_admin' => 1]);
$client = Client::create(['user_id' => $user->id, 'account_id' => $account->id, 'public_id' => 1, 'name' => $faker->name, 'address1' => $faker->streetAddress, 'address2' => $faker->secondaryAddress, 'city' => $faker->city, 'state' => $faker->state, 'postal_code' => $faker->postcode, 'country_id' => DEFAULT_COUNTRY, 'currency_id' => DEFAULT_CURRENCY]);
Contact::create(['user_id' => $user->id, 'account_id' => $account->id, 'client_id' => $client->id, 'public_id' => 1, 'email' => env('TEST_EMAIL', TEST_USERNAME), 'is_primary' => true]);
Product::create(['user_id' => $user->id, 'account_id' => $account->id, 'public_id' => 1, 'product_key' => 'ITEM', 'notes' => 'Something nice...', 'cost' => 10]);
Affiliate::create(['affiliate_key' => SELF_HOST_AFFILIATE_KEY]);
}
示例5: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
DB::table('accounts')->delete();
$accounts = array(['email' => 'root@localhost', 'password' => Hash::make('admin'), 'roles' => ['owner']], ['email' => 'unprivileged@localhost', 'password' => Hash::make('secret')], ['email' => 'ryanchenkie@gmail.com', 'password' => Hash::make('secret')], ['email' => 'chris@scotch.io', 'password' => Hash::make('secret')], ['email' => 'holly@scotch.io', 'password' => Hash::make('secret')], ['email' => 'adnan@scotch.io', 'password' => Hash::make('secret')]);
// Loop through each user above and create the record for them in the database
foreach ($accounts as $a) {
if (array_key_exists('roles', $a)) {
$roles = $a['roles'];
unset($a['roles']);
}
$user = Account::create($a);
if (isset($roles)) {
foreach ($roles as $r) {
$user->attachRole(Role::where('name', $r)->get()->first());
}
unset($roles);
}
}
Model::reguard();
}