refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
This commit is contained in:
37
database/factories/Account/AddressBookFactory.php
Normal file
37
database/factories/Account/AddressBookFactory.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories\Account;
|
||||
|
||||
use App\Models\User\User;
|
||||
use App\Models\Account\Account;
|
||||
use App\Models\Account\AddressBook;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class AddressBookFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var class-string<\Illuminate\Database\Eloquent\Model>
|
||||
*/
|
||||
protected $model = AddressBook::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'account_id' => factory(Account::class)->create(),
|
||||
'user_id' => function (array $attributes) {
|
||||
return factory(User::class)->create([
|
||||
'account_id' => $attributes['account_id'],
|
||||
]);
|
||||
},
|
||||
'name' => 'contacts1',
|
||||
'description' => $this->faker->sentence,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories\Account;
|
||||
|
||||
use App\Models\User\User;
|
||||
use App\Models\Account\Account;
|
||||
use App\Models\Account\AddressBook;
|
||||
use App\Models\Account\AddressBookSubscription;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class AddressBookSubscriptionFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var class-string<\Illuminate\Database\Eloquent\Model>
|
||||
*/
|
||||
protected $model = AddressBookSubscription::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'account_id' => factory(Account::class)->create(),
|
||||
'user_id' => function (array $attributes) {
|
||||
return factory(User::class)->create([
|
||||
'account_id' => $attributes['account_id'],
|
||||
]);
|
||||
},
|
||||
'address_book_id' => function (array $attributes) {
|
||||
return AddressBook::factory()->create([
|
||||
'account_id' => $attributes['account_id'],
|
||||
'user_id' => $attributes['user_id'],
|
||||
]);
|
||||
},
|
||||
'name' => $this->faker->word,
|
||||
'uri' => $this->faker->url,
|
||||
'capabilities' => [
|
||||
'addressbookMultiget' => true,
|
||||
'addressbookQuery' => true,
|
||||
'syncCollection' => true,
|
||||
'addressData' => [
|
||||
'content-type' => 'text/vcard',
|
||||
'version' => '4.0',
|
||||
],
|
||||
],
|
||||
'username' => $this->faker->email,
|
||||
'password' => 'password',
|
||||
'syncToken' => '"test"',
|
||||
];
|
||||
}
|
||||
}
|
||||
36
database/factories/Account/ExportJobFactory.php
Normal file
36
database/factories/Account/ExportJobFactory.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories\Account;
|
||||
|
||||
use App\Models\User\User;
|
||||
use App\Models\Account\Account;
|
||||
use App\Models\Account\ExportJob;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ExportJobFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var class-string<\Illuminate\Database\Eloquent\Model>
|
||||
*/
|
||||
protected $model = ExportJob::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'account_id' => factory(Account::class)->create(),
|
||||
'user_id' => function (array $attributes) {
|
||||
return factory(User::class)->create([
|
||||
'account_id' => $attributes['account_id'],
|
||||
]);
|
||||
},
|
||||
'type' => 'json',
|
||||
];
|
||||
}
|
||||
}
|
||||
156
database/factories/AccountFactory.php
Normal file
156
database/factories/AccountFactory.php
Normal file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use function Safe\json_decode;
|
||||
|
||||
$factory->define(App\Models\Account\Account::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'api_key' => Str::random(30),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\Activity::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'activity_type_id' => function (array $data) {
|
||||
return factory(App\Models\Account\ActivityType::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'description' => $faker->sentence,
|
||||
'summary' => $faker->sentence,
|
||||
'happened_at' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\ActivityType::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'activity_type_category_id' => function (array $data) {
|
||||
return factory(App\Models\Account\ActivityTypeCategory::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'translation_key' => $faker->sentence,
|
||||
'location_type' => $faker->word,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\ActivityTypeCategory::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'translation_key' => $faker->sentence,
|
||||
'name' => $faker->sentence,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\Company::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'name' => 'Central Perk',
|
||||
'website' => 'https://centralperk.com',
|
||||
'number_of_employees' => 4,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\ImportJob::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'user_id' => function (array $data) {
|
||||
return factory(App\Models\User\User::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\ImportJobReport::class, function (Faker\Generator $faker) {
|
||||
return [];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\Invitation::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'invited_by_user_id' => function (array $data) {
|
||||
return factory(App\Models\User\User::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'invitation_key' => Str::random(100),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\Photo::class, function (Faker\Generator $faker) {
|
||||
$account = factory(App\Models\Account\Account::class)->create();
|
||||
|
||||
return [
|
||||
'account_id' => $account->id,
|
||||
'original_filename' => 'file.jpg',
|
||||
'new_filename' => 'file.jpg',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\Place::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'country' => 'US',
|
||||
'street' => '12',
|
||||
'city' => 'beverly hills',
|
||||
'province' => null,
|
||||
'postal_code' => '90210',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\Weather::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'place_id' => function (array $data) {
|
||||
return factory(App\Models\Account\Place::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'weather_json' => json_decode('
|
||||
{
|
||||
"location": {
|
||||
"name": "Le Pre-Saint-Gervais",
|
||||
"region": "Ile-de-France",
|
||||
"country": "France",
|
||||
"lat": 48.89,
|
||||
"lon": 2.39,
|
||||
"tz_id": "Europe\/Paris",
|
||||
"localtime_epoch": 1635605324,
|
||||
"localtime": "2021-10-30 16:48"
|
||||
},
|
||||
"current": {
|
||||
"last_updated_epoch": 1635605100,
|
||||
"last_updated": "2021-10-30 16:45",
|
||||
"temp_c": 13,
|
||||
"temp_f": 55.4,
|
||||
"is_day": 0,
|
||||
"condition": {
|
||||
"text": "Partly cloudy",
|
||||
"icon": "\/\/cdn.weatherapi.com\/weather\/64x64\/night\/116.png",
|
||||
"code": 1003
|
||||
},
|
||||
"wind_mph": 5.6,
|
||||
"wind_kph": 9,
|
||||
"wind_degree": 210,
|
||||
"wind_dir": "SSW",
|
||||
"pressure_mb": 1001,
|
||||
"pressure_in": 29.56,
|
||||
"precip_mm": 0,
|
||||
"precip_in": 0,
|
||||
"humidity": 94,
|
||||
"cloud": 75,
|
||||
"feelslike_c": 11.2,
|
||||
"feelslike_f": 52.1,
|
||||
"vis_km": 10,
|
||||
"vis_miles": 6,
|
||||
"uv": 4,
|
||||
"gust_mph": 17.9,
|
||||
"gust_kph": 28.8
|
||||
}
|
||||
}'),
|
||||
'created_at' => now(),
|
||||
];
|
||||
});
|
||||
322
database/factories/ContactFactory.php
Normal file
322
database/factories/ContactFactory.php
Normal file
@@ -0,0 +1,322 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\Contact\Contact::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'first_name' => 'John',
|
||||
'last_name' => 'Doe',
|
||||
'has_avatar' => false,
|
||||
'gender_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Gender::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'uuid' => Str::uuid(),
|
||||
'default_avatar_color' => '#ffffff',
|
||||
'avatar_default_url' => 'avatars/img.png',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Contact\Contact::class, 'partial', [
|
||||
'is_partial' => 1,
|
||||
]);
|
||||
|
||||
$factory->state(App\Models\Contact\Contact::class, 'archived', [
|
||||
'is_active' => 0,
|
||||
]);
|
||||
|
||||
$factory->state(App\Models\Contact\Contact::class, 'named', function (Faker\Generator $faker) {
|
||||
return [
|
||||
'first_name' => $faker->firstName,
|
||||
'last_name' => $faker->lastName,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Contact\Contact::class, 'no_gender', function (Faker\Generator $faker) {
|
||||
return [
|
||||
'gender_id' => null,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\ContactFieldType::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'name' => 'Email',
|
||||
'protocol' => 'mailto:',
|
||||
'type' => 'email',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\ContactField::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'contact_field_type_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\ContactFieldType::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'data' => 'john@doe.com',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\ContactFieldLabel::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'label_i18n' => 'work',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Conversation::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'contact_field_type_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\ContactFieldType::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Reminder::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\ReminderOutbox::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'user_id' => function (array $data) {
|
||||
return factory(App\Models\User\User::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'reminder_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Reminder::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'planned_date' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Gift::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'status' => 'idea',
|
||||
'created_at' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Call::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'created_at' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Task::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'title' => $faker->word,
|
||||
'description' => $faker->word,
|
||||
'completed' => 0,
|
||||
'created_at' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
'uuid' => Str::uuid(),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Note::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'body' => encrypt($faker->text(200)),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Address::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'place_id' => function (array $data) {
|
||||
return factory(App\Models\Account\Place::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Gender::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'type' => 'M',
|
||||
'name' => 'Man',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Debt::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Tag::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'name' => $faker->word,
|
||||
'name_slug' => Str::slug($faker->word),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Pet::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'pet_category_id' => factory(App\Models\Contact\PetCategory::class)->create()->id,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\PetCategory::class, function (Faker\Generator $faker) {
|
||||
return [];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\ReminderRule::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Message::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'conversation_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Conversation::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Document::class, function (Faker\Generator $faker) {
|
||||
$contact = factory(App\Models\Contact\Contact::class)->create();
|
||||
|
||||
return [
|
||||
'account_id' => $contact->account_id,
|
||||
'contact_id' => $contact->id,
|
||||
'original_filename' => 'file.jpg',
|
||||
'new_filename' => 'file.jpg',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Occupation::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'company_id' => function (array $data) {
|
||||
return factory(App\Models\Account\Company::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'title' => 'Waiter',
|
||||
'salary' => '10000',
|
||||
'salary_unit' => 'year',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\LifeEventCategory::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'name' => $faker->text(100),
|
||||
'core_monica_data' => true,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\LifeEventType::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'life_event_category_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\LifeEventCategory::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'name' => $faker->text(100),
|
||||
'core_monica_data' => true,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\LifeEvent::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'life_event_type_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\LifeEventType::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'name' => $faker->text(100),
|
||||
'note' => $faker->text(100),
|
||||
'happened_at' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
];
|
||||
});
|
||||
69
database/factories/InstanceFactory.php
Normal file
69
database/factories/InstanceFactory.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
$factory->define(\App\Models\Instance\Cron::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'command' => $faker->word,
|
||||
'last_run' => now(),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Instance\SpecialDate::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'date' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
'created_at' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Instance\Instance::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'uuid' => $faker->uuid,
|
||||
'latest_version' => '1.0.0',
|
||||
'current_version' => '1.0.0',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Instance\Emotion\Emotion::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'emotion_primary_id' => factory(App\Models\Instance\Emotion\PrimaryEmotion::class)->create()->id,
|
||||
'emotion_secondary_id' => function (array $data) {
|
||||
return factory(App\Models\Instance\Emotion\SecondaryEmotion::class)->create([
|
||||
'emotion_primary_id' => $data['emotion_primary_id'],
|
||||
])->id;
|
||||
},
|
||||
'name' => $faker->text(5),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Instance\Emotion\SecondaryEmotion::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'emotion_primary_id' => factory(App\Models\Instance\Emotion\PrimaryEmotion::class)->create()->id,
|
||||
'name' => $faker->text(5),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Instance\Emotion\PrimaryEmotion::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'name' => $faker->text(5),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Instance\AuditLog::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'author_id' => function (array $data) {
|
||||
return factory(App\Models\User\User::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'action' => 'account_created',
|
||||
'author_name' => 'Dwight Schrute',
|
||||
'audited_at' => $faker->dateTimeThisCentury(),
|
||||
'objects' => '{"user": 1}',
|
||||
];
|
||||
});
|
||||
19
database/factories/JournalFactory.php
Normal file
19
database/factories/JournalFactory.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$factory->define(App\Models\Journal\Entry::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Journal\Day::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Journal\JournalEntry::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
];
|
||||
});
|
||||
39
database/factories/RelationshipFactory.php
Normal file
39
database/factories/RelationshipFactory.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
$factory->define(App\Models\Relationship\Relationship::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'relationship_type_id' => function (array $data) {
|
||||
return factory(App\Models\Relationship\RelationshipType::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'contact_is' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'of_contact' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Relationship\RelationshipType::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'relationship_type_group_id' => function (array $data) {
|
||||
return factory(App\Models\Relationship\RelationshipTypeGroup::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Relationship\RelationshipTypeGroup::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
];
|
||||
});
|
||||
29
database/factories/SettingsFactory.php
Normal file
29
database/factories/SettingsFactory.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
$factory->define(App\Models\Settings\Term::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'term_version' => $faker->realText(50),
|
||||
'term_content' => $faker->realText(50),
|
||||
'privacy_version' => $faker->realText(50),
|
||||
'privacy_content' => $faker->realText(50),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Settings\Currency::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'iso' => $faker->realText(10),
|
||||
'name' => $faker->realText(10),
|
||||
'symbol' => $faker->realText(10),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(\Laravel\Cashier\Subscription::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'name' => $faker->word(),
|
||||
'stripe_id' => $faker->word(),
|
||||
'stripe_price' => $faker->randomElement(['plan-1', 'plan-2', 'plan-3']),
|
||||
'quantity' => 1,
|
||||
'created_at' => now(),
|
||||
];
|
||||
});
|
||||
45
database/factories/UserFactory.php
Normal file
45
database/factories/UserFactory.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\User\User::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'first_name' => $faker->firstName,
|
||||
'last_name' => $faker->lastName,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'email_verified_at' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
'password' => bcrypt(Str::random(10)),
|
||||
'remember_token' => Str::random(10),
|
||||
'timezone' => config('app.timezone'),
|
||||
'name_order' => 'firstname_lastname',
|
||||
'locale' => 'en',
|
||||
'currency_id' => function (array $data) {
|
||||
return factory(App\Models\Settings\Currency::class)->create([
|
||||
'iso' => 'USD',
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\User\Changelog::class, function (Faker\Generator $faker) {
|
||||
return [];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\User\Module::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\User\SyncToken::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'user_id' => function (array $data) {
|
||||
return factory(App\Models\User\User::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'timestamp' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
];
|
||||
});
|
||||
27
database/factories/WebauthnFactory.php
Normal file
27
database/factories/WebauthnFactory.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of your model factories. Model factories give
|
||||
| you a convenient way to create models for testing and seeding your
|
||||
| database. Just tell the factory how a default model should look.
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(\LaravelWebauthn\Models\WebauthnKey::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'user_id' => '0',
|
||||
'name' => $faker->word,
|
||||
'counter' => 0,
|
||||
'credentialId' => 'MA==',
|
||||
'type' => 'public-key',
|
||||
'transports' => [],
|
||||
'attestationType' => 'none',
|
||||
'trustPath' => new \Webauthn\TrustPath\EmptyTrustPath,
|
||||
'aaguid' => '0000000000000000',
|
||||
'credentialPublicKey' => 'oWNrZXlldmFsdWU=',
|
||||
];
|
||||
});
|
||||
Reference in New Issue
Block a user