Merge pull request #1091 from SevanNerse/dev

Factory is added for Contact model
This commit is contained in:
Denis Duliçi 2020-01-07 00:22:24 +03:00 committed by GitHub
commit 472a4e00df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,28 @@
<?php
use App\Models\Auth\User;
use App\Models\Common\Contact;
use Faker\Generator as Faker;
$user = User::first();
$company = $user->companies()->first();
$factory->define(Contact::class, function (Faker $faker) use ($company) {
setting()->setExtraColumns([
'company_id' => $company->id
]);
return [
'company_id' => $company->id,
'type' => $faker->boolean ? 'customer' : 'vendor',
'name' => $faker->text(15),
'email' => '',
'user_id' => null,
'tax_number' => null,
'phone' => null,
'address' => null,
'website' => null,
'currency_code' => setting('default.currency'),
'reference' => null,
'enabled' => $faker->boolean ? 1 : 0
];
});