Merge pull request #1091 from SevanNerse/dev
Factory is added for Contact model
This commit is contained in:
commit
472a4e00df
28
database/factories/Contact.php
Normal file
28
database/factories/Contact.php
Normal 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
|
||||||
|
];
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user