1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 05:32:39 +01:00
invoiceninja/database/seeds/UsersTableSeeder.php
David Bomba 62e2444a2c
Sign Up Scaffolding (#2453)
* Fix js dependencies

* Breadcrumb implementation

* Test for UniqueEmailRule Validation

* reduce length of account_key to prevent key too long error

* Fixes for travis - reduce user email length

* Reduce all unique field lengths to 100 to prevent key overflow

* Fix for Bank Model

* Prevent a user from registering multiple account with one email address when using multiple databases
2018-10-17 23:26:27 +11:00

67 lines
1.6 KiB
PHP

<?php
use App\Models\Account;
use App\Models\Client;
use App\Models\Contact;
use App\Models\User;
use App\Models\UserAccount;
use Illuminate\Database\Seeder;
class UsersTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//require_once app_path() . '/Constants.php';
$this->command->info('Running UserTableSeeder');
Eloquent::unguard();
$faker = Faker\Factory::create();
$account = Account::create([
'name' => $faker->name(),
]);
$user = User::create([
'first_name' => $faker->firstName,
'last_name' => $faker->lastName,
'email' => TEST_USERNAME,
'password' => Hash::make(TEST_PASSWORD),
'registered' => true,
'confirmed' => true,
]);
$client = Client::create([
'name' => $faker->name,
'account_id' => $account->id,
]);
Contact::create([
'first_name' => $faker->firstName,
'last_name' => $faker->lastName,
'email' => TEST_CLIENTNAME,
'account_id' => $account->id,
'password' => Hash::make(TEST_PASSWORD),
'registered' => true,
'confirmed' => true,
'client_id' =>$client->id,
]);
UserAccount::create([
'account_id' => $account->id,
'user_id' => $user->id,
'is_owner' => 1,
'is_admin' => 1,
'is_locked' => 0,
'is_default' => 1,
]);
}
}