1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-18 00:53:10 +01:00

Added more data to test user seeder

This commit is contained in:
Hillel Coren 2016-06-06 22:45:21 +03:00
parent 7730904bda
commit 0238067af3

View File

@ -7,6 +7,9 @@ use App\Models\Company;
use App\Models\Affiliate;
use App\Models\Country;
use App\Models\InvoiceDesign;
use App\Models\Client;
use App\Models\Contact;
use App\Models\Product;
use Faker\Factory;
class UserTableSeeder extends Seeder
@ -41,7 +44,9 @@ class UserTableSeeder extends Seeder
'company_id' => $company->id,
]);
User::create([
$user = User::create([
'first_name' => $faker->firstName,
'last_name' => $faker->lastName,
'email' => TEST_USERNAME,
'username' => TEST_USERNAME,
'account_id' => $account->id,
@ -52,6 +57,36 @@ class UserTableSeeder extends Seeder
'notify_paid' => false,
]);
$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' => Country::all()->random()->id,
]);
Contact::create([
'user_id' => $user->id,
'account_id' => $account->id,
'client_id' => $client->id,
'public_id' => 1,
'email' => TEST_USERNAME,
]);
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
]);