mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
15320500c0
@ -48,6 +48,7 @@ REQUIRE_HTTPS=false
|
||||
GOOGLE_MAPS_API_KEY=
|
||||
API_SECRET=superdoopersecrethere
|
||||
ERROR_EMAIL=
|
||||
TRUSTED_PROXIES=
|
||||
|
||||
NINJA_ENVIRONMENT=selfhost
|
||||
|
||||
|
@ -27,12 +27,19 @@ use App\Helpers\Invoice\InvoiceSum;
|
||||
use App\Jobs\Quote\CreateQuoteInvitations;
|
||||
use App\Listeners\Credit\CreateCreditInvitation;
|
||||
use App\Listeners\Invoice\CreateInvoiceInvitation;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\CompanyToken;
|
||||
use App\Models\Country;
|
||||
use App\Models\Expense;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\Product;
|
||||
use App\Models\Project;
|
||||
use App\Models\Task;
|
||||
use App\Models\User;
|
||||
use App\Models\Vendor;
|
||||
use App\Models\VendorContact;
|
||||
use App\Repositories\InvoiceRepository;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
@ -93,8 +100,8 @@ class CreateTestData extends Command
|
||||
{
|
||||
$this->info('Creating Small Account and Company');
|
||||
|
||||
$account = factory(\App\Models\Account::class)->create();
|
||||
$company = factory(\App\Models\Company::class)->create([
|
||||
$account = Account::factory()->create();
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'slack_webhook_url' => config('ninja.notification.slack'),
|
||||
]);
|
||||
@ -105,7 +112,7 @@ class CreateTestData extends Command
|
||||
$user = User::whereEmail('small@example.com')->first();
|
||||
|
||||
if (! $user) {
|
||||
$user = factory(\App\Models\User::class)->create([
|
||||
$user = User::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'email' => 'small@example.com',
|
||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
||||
@ -132,7 +139,7 @@ class CreateTestData extends Command
|
||||
'settings' => null,
|
||||
]);
|
||||
|
||||
factory(\App\Models\Product::class, 50)->create([
|
||||
Product::factory()->count(50)->create([
|
||||
'user_id' => $user->id,
|
||||
'company_id' => $company->id,
|
||||
]);
|
||||
@ -188,8 +195,8 @@ class CreateTestData extends Command
|
||||
{
|
||||
$this->info('Creating Medium Account and Company');
|
||||
|
||||
$account = factory(\App\Models\Account::class)->create();
|
||||
$company = factory(\App\Models\Company::class)->create([
|
||||
$account = Account::factory()->create();
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'slack_webhook_url' => config('ninja.notification.slack'),
|
||||
]);
|
||||
@ -200,7 +207,7 @@ class CreateTestData extends Command
|
||||
$user = User::whereEmail('medium@example.com')->first();
|
||||
|
||||
if (! $user) {
|
||||
$user = factory(\App\Models\User::class)->create([
|
||||
$user = User::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'email' => 'medium@example.com',
|
||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
||||
@ -226,7 +233,7 @@ class CreateTestData extends Command
|
||||
'settings' => null,
|
||||
]);
|
||||
|
||||
factory(\App\Models\Product::class, 50)->create([
|
||||
Product::factory()->count(50)->create([
|
||||
'user_id' => $user->id,
|
||||
'company_id' => $company->id,
|
||||
]);
|
||||
@ -284,8 +291,8 @@ class CreateTestData extends Command
|
||||
{
|
||||
$this->info('Creating Large Account and Company');
|
||||
|
||||
$account = factory(\App\Models\Account::class)->create();
|
||||
$company = factory(\App\Models\Company::class)->create([
|
||||
$account = Account::factory()->create();
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'slack_webhook_url' => config('ninja.notification.slack'),
|
||||
'is_large' => true,
|
||||
@ -297,7 +304,7 @@ class CreateTestData extends Command
|
||||
$user = User::whereEmail('large@example.com')->first();
|
||||
|
||||
if (! $user) {
|
||||
$user = factory(\App\Models\User::class)->create([
|
||||
$user = User::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'email' => 'large@example.com',
|
||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
||||
@ -323,7 +330,7 @@ class CreateTestData extends Command
|
||||
'settings' => null,
|
||||
]);
|
||||
|
||||
factory(\App\Models\Product::class, 15000)->create([
|
||||
Product::factory()->count(15000)->create([
|
||||
'user_id' => $user->id,
|
||||
'company_id' => $company->id,
|
||||
]);
|
||||
@ -383,19 +390,19 @@ class CreateTestData extends Command
|
||||
// dispatch(function () use ($company, $user) {
|
||||
|
||||
// });
|
||||
$client = factory(\App\Models\Client::class)->create([
|
||||
$client = Client::factory()->create([
|
||||
'user_id' => $user->id,
|
||||
'company_id' => $company->id,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $client->id,
|
||||
'company_id' => $company->id,
|
||||
'is_primary' => 1,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, rand(1, 5))->create([
|
||||
ClientContact::factory()->count(rand(1, 5))->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $client->id,
|
||||
'company_id' => $company->id,
|
||||
@ -415,7 +422,7 @@ class CreateTestData extends Command
|
||||
|
||||
private function createExpense($client)
|
||||
{
|
||||
factory(\App\Models\Expense::class, rand(1, 5))->create([
|
||||
Expense::factory()->count(rand(1, 5))->create([
|
||||
'user_id' => $client->user->id,
|
||||
'client_id' => $client->id,
|
||||
'company_id' => $client->company->id,
|
||||
@ -424,19 +431,19 @@ class CreateTestData extends Command
|
||||
|
||||
private function createVendor($client)
|
||||
{
|
||||
$vendor = factory(\App\Models\Vendor::class)->create([
|
||||
$vendor = Vendor::factory()->create([
|
||||
'user_id' => $client->user->id,
|
||||
'company_id' => $client->company->id,
|
||||
]);
|
||||
|
||||
factory(\App\Models\VendorContact::class, 1)->create([
|
||||
VendorContact::factory()->create([
|
||||
'user_id' => $client->user->id,
|
||||
'vendor_id' => $vendor->id,
|
||||
'company_id' => $client->company->id,
|
||||
'is_primary' => 1,
|
||||
]);
|
||||
|
||||
factory(\App\Models\VendorContact::class, rand(1, 5))->create([
|
||||
VendorContact::factory()->count(rand(1, 5))->create([
|
||||
'user_id' => $client->user->id,
|
||||
'vendor_id' => $vendor->id,
|
||||
'company_id' => $client->company->id,
|
||||
@ -446,7 +453,7 @@ class CreateTestData extends Command
|
||||
|
||||
private function createTask($client)
|
||||
{
|
||||
$vendor = factory(\App\Models\Task::class)->create([
|
||||
$vendor = Task::factory()->create([
|
||||
'user_id' => $client->user->id,
|
||||
'company_id' => $client->company->id,
|
||||
]);
|
||||
@ -454,7 +461,7 @@ class CreateTestData extends Command
|
||||
|
||||
private function createProject($client)
|
||||
{
|
||||
$vendor = factory(\App\Models\Project::class)->create([
|
||||
$vendor = Project::factory()->create([
|
||||
'user_id' => $client->user->id,
|
||||
'company_id' => $client->company->id,
|
||||
]);
|
||||
@ -520,7 +527,7 @@ class CreateTestData extends Command
|
||||
// }
|
||||
$faker = \Faker\Factory::create();
|
||||
|
||||
$credit = factory(\App\Models\Credit::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
|
||||
$credit = Credit::factory()->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
|
||||
|
||||
$dateable = Carbon::now()->subDays(rand(0, 90));
|
||||
$credit->date = $dateable;
|
||||
@ -564,7 +571,7 @@ class CreateTestData extends Command
|
||||
$faker = \Faker\Factory::create();
|
||||
|
||||
//$quote = QuoteFactory::create($client->company->id, $client->user->id);//stub the company and user_id
|
||||
$quote = factory(\App\Models\Quote::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
|
||||
$quote = Quote::factory()->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
|
||||
$quote->date = $faker->date();
|
||||
$quote->client_id = $client->id;
|
||||
|
||||
|
@ -18,10 +18,21 @@ use App\Factory\InvoiceItemFactory;
|
||||
use App\Helpers\Invoice\InvoiceSum;
|
||||
use App\Jobs\Ninja\CompanySizeCheck;
|
||||
use App\Jobs\Util\VersionCheck;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyToken;
|
||||
use App\Models\Country;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Expense;
|
||||
use App\Models\Product;
|
||||
use App\Models\Project;
|
||||
use App\Models\Quote;
|
||||
use App\Models\Task;
|
||||
use App\Models\User;
|
||||
use App\Models\Vendor;
|
||||
use App\Models\VendorContact;
|
||||
use App\Repositories\InvoiceRepository;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
@ -30,8 +41,8 @@ use Carbon\Carbon;
|
||||
use Composer\Composer;
|
||||
use Composer\Console\Application;
|
||||
use Composer\Factory;
|
||||
use Composer\Installer;
|
||||
use Composer\IO\NullIO;
|
||||
use Composer\Installer;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
@ -125,8 +136,8 @@ class DemoMode extends Command
|
||||
|
||||
$this->info('Creating Small Account and Company');
|
||||
|
||||
$account = factory(\App\Models\Account::class)->create();
|
||||
$company = factory(\App\Models\Company::class)->create([
|
||||
$account = Account::factory()->create();
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'slack_webhook_url' => config('ninja.notification.slack'),
|
||||
'enabled_modules' => 32767,
|
||||
@ -155,7 +166,7 @@ class DemoMode extends Command
|
||||
$user = User::whereEmail('small@example.com')->first();
|
||||
|
||||
if (! $user) {
|
||||
$user = factory(\App\Models\User::class)->create([
|
||||
$user = User::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'email' => 'small@example.com',
|
||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
||||
@ -185,7 +196,7 @@ class DemoMode extends Command
|
||||
$u2 = User::where('email', 'demo@invoiceninja.com')->first();
|
||||
|
||||
if (! $u2) {
|
||||
$u2 = factory(\App\Models\User::class)->create([
|
||||
$u2 = User::factory()->create([
|
||||
'email' => 'demo@invoiceninja.com',
|
||||
'password' => Hash::make('demo'),
|
||||
'account_id' => $account->id,
|
||||
@ -211,7 +222,7 @@ class DemoMode extends Command
|
||||
]);
|
||||
}
|
||||
|
||||
factory(\App\Models\Product::class, 50)->create([
|
||||
Product::factory()->count(50)->create([
|
||||
'user_id' => $user->id,
|
||||
'company_id' => $company->id,
|
||||
]);
|
||||
@ -277,19 +288,19 @@ class DemoMode extends Command
|
||||
// dispatch(function () use ($company, $user) {
|
||||
|
||||
// });
|
||||
$client = factory(\App\Models\Client::class)->create([
|
||||
$client = Client::factory()->create([
|
||||
'user_id' => $user->id,
|
||||
'company_id' => $company->id,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class)->create([
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $client->id,
|
||||
'company_id' => $company->id,
|
||||
'is_primary' => 1,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, rand(1, 5))->create([
|
||||
ClientContact::factory()->count(rand(1,5))->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $client->id,
|
||||
'company_id' => $company->id,
|
||||
@ -311,7 +322,7 @@ class DemoMode extends Command
|
||||
|
||||
private function createExpense($client)
|
||||
{
|
||||
factory(\App\Models\Expense::class, rand(1, 5))->create([
|
||||
Expense::factory()->count(rand(1,5))->create([
|
||||
'user_id' => $client->user_id,
|
||||
'client_id' => $client->id,
|
||||
'company_id' => $client->company_id,
|
||||
@ -320,19 +331,19 @@ class DemoMode extends Command
|
||||
|
||||
private function createVendor($client, $assigned_user_id = null)
|
||||
{
|
||||
$vendor = factory(\App\Models\Vendor::class)->create([
|
||||
$vendor = Vendor::factory()->create([
|
||||
'user_id' => $client->user_id,
|
||||
'company_id' => $client->company_id,
|
||||
]);
|
||||
|
||||
factory(\App\Models\VendorContact::class)->create([
|
||||
VendorContact::factory()->create([
|
||||
'user_id' => $client->user->id,
|
||||
'vendor_id' => $vendor->id,
|
||||
'company_id' => $client->company_id,
|
||||
'is_primary' => 1,
|
||||
]);
|
||||
|
||||
factory(\App\Models\VendorContact::class, rand(1, 5))->create([
|
||||
VendorContact::factory()->count(rand(1,5))->create([
|
||||
'user_id' => $client->user->id,
|
||||
'vendor_id' => $vendor->id,
|
||||
'company_id' => $client->company_id,
|
||||
@ -342,7 +353,7 @@ class DemoMode extends Command
|
||||
|
||||
private function createTask($client, $assigned_user_id = null)
|
||||
{
|
||||
$vendor = factory(\App\Models\Task::class)->create([
|
||||
$vendor = Task::factory()->create([
|
||||
'user_id' => $client->user->id,
|
||||
'company_id' => $client->company_id,
|
||||
]);
|
||||
@ -350,7 +361,7 @@ class DemoMode extends Command
|
||||
|
||||
private function createProject($client, $assigned_user_id = null)
|
||||
{
|
||||
$vendor = factory(\App\Models\Project::class)->create([
|
||||
$vendor = Project::factory()->create([
|
||||
'user_id' => $client->user->id,
|
||||
'company_id' => $client->company_id,
|
||||
]);
|
||||
@ -430,7 +441,7 @@ class DemoMode extends Command
|
||||
// }
|
||||
$faker = \Faker\Factory::create();
|
||||
|
||||
$credit = factory(\App\Models\Credit::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
|
||||
$credit = Credit::factory()->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
|
||||
|
||||
if ((bool) rand(0, 1)) {
|
||||
$dateable = Carbon::now()->subDays(rand(0, 90));
|
||||
@ -478,7 +489,7 @@ class DemoMode extends Command
|
||||
{
|
||||
$faker = \Faker\Factory::create();
|
||||
|
||||
$quote = factory(\App\Models\Quote::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company_id, 'client_id' => $client->id]);
|
||||
$quote = Quote::factory()->create(['user_id' => $client->user->id, 'company_id' => $client->company_id, 'client_id' => $client->id]);
|
||||
|
||||
if ((bool) rand(0, 1)) {
|
||||
$dateable = Carbon::now()->subDays(rand(1, 30));
|
||||
|
@ -78,7 +78,7 @@ class ImportMigrations extends Command
|
||||
$account = $this->getAccount();
|
||||
$company = $this->getCompany($account);
|
||||
|
||||
$user = factory(\App\Models\User::class)->create([
|
||||
$user = User::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'email' => $this->faker->email,
|
||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
||||
@ -107,7 +107,7 @@ class ImportMigrations extends Command
|
||||
|
||||
public function getAccount(): Account
|
||||
{
|
||||
return factory(\App\Models\Account::class)->create();
|
||||
return Account::factory()->create();
|
||||
}
|
||||
|
||||
public function getCompany(Account $account): Company
|
||||
|
@ -20,8 +20,10 @@ use App\Factory\InvoiceInvitationFactory;
|
||||
use App\Helpers\Email\InvoiceEmail;
|
||||
use App\Jobs\Invoice\CreateInvoicePdf;
|
||||
use App\Mail\TemplateEmail;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Company;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\User;
|
||||
use Illuminate\Console\Command;
|
||||
@ -80,9 +82,10 @@ class SendTestEmails extends Command
|
||||
$user = User::whereEmail('user@example.com')->first();
|
||||
|
||||
if (! $user) {
|
||||
$account = factory(\App\Models\Account::class)->create();
|
||||
|
||||
$account = Account::factory()->create();
|
||||
|
||||
$user = factory(\App\Models\User::class)->create([
|
||||
$user = User::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'confirmation_code' => '123',
|
||||
'email' => $faker->safeEmail,
|
||||
@ -90,7 +93,7 @@ class SendTestEmails extends Command
|
||||
'last_name' => 'Doe',
|
||||
]);
|
||||
|
||||
$company = factory(\App\Models\Company::class)->create([
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
]);
|
||||
|
||||
@ -115,7 +118,7 @@ class SendTestEmails extends Command
|
||||
$client = ClientFactory::create($company->id, $user->id);
|
||||
$client->save();
|
||||
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $client->id,
|
||||
'company_id' => $company->id,
|
||||
@ -124,7 +127,7 @@ class SendTestEmails extends Command
|
||||
'email' => $faker->safeEmail,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $client->id,
|
||||
'company_id' => $company->id,
|
||||
|
@ -56,7 +56,7 @@ class CreateTestCreditJob implements ShouldQueue
|
||||
{
|
||||
$faker = \Faker\Factory::create();
|
||||
|
||||
$credit = factory(\App\Models\Credit::class)->create(['user_id' => $this->client->user->id, 'company_id' => $this->client->company->id, 'client_id' => $this->client->id]);
|
||||
$credit = Credit::factory()->create(['user_id' => $this->client->user->id, 'company_id' => $this->client->company->id, 'client_id' => $this->client->id]);
|
||||
|
||||
//$invoice = InvoiceFactory::create($this->client->company->id, $this->client->user->id);//stub the company and user_id
|
||||
//$invoice->client_id = $this->client->id;
|
||||
|
@ -55,7 +55,7 @@ class CreateTestQuoteJob implements ShouldQueue
|
||||
{
|
||||
$faker = \Faker\Factory::create();
|
||||
|
||||
$quote = factory(\App\Models\Quote::class)->create(['user_id' => $this->client->user->id, 'company_id' => $this->client->company->id, 'client_id' => $this->client->id]);
|
||||
$quote = Quote::factory()->create(['user_id' => $this->client->user->id, 'company_id' => $this->client->company->id, 'client_id' => $this->client->id]);
|
||||
$quote->date = $faker->date();
|
||||
|
||||
$quote->line_items = $this->buildLineItems(rand(1, 10));
|
||||
|
@ -585,11 +585,11 @@ class CompanySettings extends BaseSettings
|
||||
'$quote.total',
|
||||
],
|
||||
'credit_details' => [
|
||||
'$credit.credit_number',
|
||||
'$credit.number',
|
||||
'$credit.po_number',
|
||||
'$credit.credit_date',
|
||||
'$credit.credit_balance',
|
||||
'$credit.credit_amount',
|
||||
'$credit.date',
|
||||
'$credit.balance',
|
||||
'$credit.total',
|
||||
],
|
||||
'product_columns' => [
|
||||
'$product.product_key',
|
||||
|
@ -332,11 +332,11 @@ class Designer
|
||||
private function creditDetails(Company $company)
|
||||
{
|
||||
$data = [
|
||||
'$credit.credit_number' => '<span class="flex justify-between items-center">$credit.number_label<span></span><span>$credit.number</span></span>',
|
||||
'$credit.number' => '<span class="flex justify-between items-center">$credit.number_label<span></span><span>$credit.number</span></span>',
|
||||
'$credit.po_number' => '<span class="flex justify-between items-center">$credit.po_number_label<span></span><span>$credit.po_number</span></span>',
|
||||
'$credit.credit_date' => '<span class="flex justify-between items-center">$credit.date_label<span></span><span>$credit.date</span></span>',
|
||||
'$credit.credit_balance' => '<span class="flex justify-between items-center">$credit.balance_label<span></span><span>$credit.balance</span></span>',
|
||||
'$credit.credit_amount' => '<span class="flex justify-between items-center">$credit.amount_label<span></span><span>$credit.amount</span></span>',
|
||||
'$credit.date' => '<span class="flex justify-between items-center">$credit.date_label<span></span><span>$credit.date</span></span>',
|
||||
'$credit.balance' => '<span class="flex justify-between items-center">$credit.balance_label<span></span><span>$credit.balance</span></span>',
|
||||
'$credit.total' => '<span class="flex justify-between items-center">$credit.total_label<span></span><span>$credit.total</span></span>',
|
||||
'$credit.partial_due' => '<span class="flex justify-between items-center">$credit.partial_due_label<span></span><span>$credit.partial_due</span></span>',
|
||||
'$credit.custom1' => '<span class="flex justify-between items-center">$credit.custom1_label<span></span><span>$credit.custom1</span></span>',
|
||||
'$credit.custom2' => '<span class="flex justify-between items-center">$credit.custom2_label<span></span><span>$credit.custom2</span></span>',
|
||||
|
@ -32,6 +32,7 @@ use App\Jobs\Invoice\CreateInvoicePdf;
|
||||
use App\Jobs\Invoice\EmailInvoice;
|
||||
use App\Jobs\Invoice\StoreInvoice;
|
||||
use App\Jobs\Invoice\ZipInvoices;
|
||||
use App\Jobs\Util\UnlinkFile;
|
||||
use App\Models\Client;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\InvoiceInvitation;
|
||||
@ -391,6 +392,8 @@ class InvoiceController extends BaseController
|
||||
|
||||
$invoice = $this->invoice_repo->save($request->all(), $invoice);
|
||||
|
||||
UnlinkFile::dispatchNow(config('filesystems.default'),$invoice->client->invoice_filepath().$invoice->number.'.pdf');
|
||||
|
||||
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars()));
|
||||
|
||||
return $this->itemResponse($invoice);
|
||||
|
@ -132,12 +132,12 @@ class PreviewController extends BaseController
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
$client = factory(\App\Models\Client::class)->create([
|
||||
$client = Client::factory()->create([
|
||||
'user_id' => auth()->user()->id,
|
||||
'company_id' => auth()->user()->company()->id,
|
||||
]);
|
||||
|
||||
$contact = factory(\App\Models\ClientContact::class)->create([
|
||||
$contact = ClientContact::factory()->create([
|
||||
'user_id' => auth()->user()->id,
|
||||
'company_id' => auth()->user()->company()->id,
|
||||
'client_id' => $client->id,
|
||||
@ -145,13 +145,13 @@ class PreviewController extends BaseController
|
||||
'send_email' => true,
|
||||
]);
|
||||
|
||||
$invoice = factory(\App\Models\Invoice::class)->create([
|
||||
$invoice = Invoice::factory()->create([
|
||||
'user_id' => auth()->user()->id,
|
||||
'company_id' => auth()->user()->company()->id,
|
||||
'client_id' => $client->id,
|
||||
]);
|
||||
|
||||
$invitation = factory(\App\Models\InvoiceInvitation::class)->create([
|
||||
$invitation = InvoiceInvitation::factory()->create([
|
||||
'user_id' => auth()->user()->id,
|
||||
'company_id' => auth()->user()->company()->id,
|
||||
'invoice_id' => $invoice->id,
|
||||
|
@ -12,16 +12,21 @@
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\CompanyToken;
|
||||
use Closure;
|
||||
use Auth;
|
||||
use Closure;
|
||||
|
||||
class ContactKeyLogin
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* Sets a contact LOGGED IN if an appropriate client_hash is provided as a query parameter
|
||||
* OR
|
||||
* If the contact_key is provided in the route
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
@ -47,6 +52,25 @@ class ContactKeyLogin
|
||||
return redirect()->to('client/dashboard');
|
||||
}
|
||||
|
||||
}
|
||||
else if($request->has('client_hash') && config('ninja.db.multi_db_enabled')){
|
||||
|
||||
if (MultiDB::findAndSetDbByClientHash($request->input('client_hash'))) {
|
||||
|
||||
$client = Client::where('client_hash', $request->input('client_hash'))->first();
|
||||
Auth::guard('contact')->login($client->primary_contact()->first(), true);
|
||||
return redirect()->to('client/dashboard');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else if($request->has('client_hash')){
|
||||
|
||||
if($client = Client::where('client_hash', $request->input('client_hash'))->first()){
|
||||
Auth::guard('contact')->login($client->primary_contact()->first(), true);
|
||||
return redirect()->to('client/dashboard');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
@ -13,6 +13,7 @@ namespace App\Http\Middleware;
|
||||
|
||||
use Fideloper\Proxy\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
@ -29,4 +30,18 @@ class TrustProxies extends Middleware
|
||||
* @var int
|
||||
*/
|
||||
protected $headers = Request::HEADER_X_FORWARDED_ALL;
|
||||
|
||||
/*
|
||||
* Instantiate trusted proxies middleware
|
||||
*
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
*/
|
||||
public function __construct(Repository $config) {
|
||||
|
||||
parent::__construct($config);
|
||||
|
||||
if (config('ninja.trusted_proxies'))
|
||||
$this->proxies = config('ninja.trusted_proxies');
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class StoreRecurringInvoiceRequest extends Request
|
||||
if(isset($input['auto_bill']))
|
||||
$input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']);
|
||||
else{
|
||||
$client = Client::find($this->decodePrimaryKey($input['client_id']));
|
||||
$client = Client::find($input['client_id']);
|
||||
$input['auto_bill'] = $client->getSetting('auto_bill');
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ class Import implements ShouldQueue
|
||||
|
||||
public $timeout = 86400;
|
||||
|
||||
public $retryAfter = 86430;
|
||||
public $backoff = 86430;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
|
@ -54,7 +54,7 @@ class StartMigration implements ShouldQueue
|
||||
|
||||
public $timeout = 86400;
|
||||
|
||||
public $retryAfter = 86430;
|
||||
public $backoff = 86430;
|
||||
|
||||
public function __construct($filepath, User $user, Company $company)
|
||||
{
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Libraries;
|
||||
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyToken;
|
||||
@ -200,7 +201,6 @@ class MultiDB
|
||||
foreach (self::$dbs as $db) {
|
||||
if ($client_contact = ClientContact::on($db)->where('contact_key', $contact_key)->first()) {
|
||||
self::setDb($client_contact->company->db);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -208,6 +208,17 @@ class MultiDB
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function findAndSetDbByClientHash($client_hash) :bool
|
||||
{
|
||||
foreach (self::$dbs as $db) {
|
||||
if ($client = Client::on($db)->where('client_hash', $client_hash)->first()) {
|
||||
self::setDb($client->company->db);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function findAndSetDbByDomain($subdomain) :bool
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ class DeletedUserActivity implements ShouldQueue
|
||||
|
||||
$fields = new \stdClass;
|
||||
|
||||
if (auth()->user()->id) {
|
||||
if (auth()->check()) {
|
||||
$fields->user_id = auth()->user()->id;
|
||||
} else {
|
||||
$fields->user_id = $event->user->id;
|
||||
|
@ -70,6 +70,7 @@ class TemplateEmail extends Mailable
|
||||
'signature' => $settings->email_signature,
|
||||
'settings' => $settings,
|
||||
'company' => $company,
|
||||
'whitelabel' => $this->client->user->account->isPaid() ? true : false,
|
||||
]);
|
||||
|
||||
//conditionally attach files
|
||||
|
@ -24,12 +24,14 @@ use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundExceptio
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class BaseModel extends Model
|
||||
{
|
||||
use MakesHash;
|
||||
use UserSessionAttributes;
|
||||
|
||||
use HasFactory;
|
||||
|
||||
//todo customise names of archived_at / updated_at columns
|
||||
///const CREATED_AT = 'creation_date';
|
||||
//const UPDATED_AT = 'last_update';
|
||||
|
@ -14,12 +14,13 @@ namespace App\Models;
|
||||
use App\Models\Company;
|
||||
use App\Models\Language;
|
||||
use App\Models\User;
|
||||
use App\Notifications\ClientContactResetPassword;
|
||||
use App\Notifications\ClientContactResetPassword as ResetPasswordNotification;
|
||||
use App\Notifications\ClientContactResetPassword;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Hashids\Hashids;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Contracts\Translation\HasLocalePreference;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
@ -33,7 +34,8 @@ class ClientContact extends Authenticatable implements HasLocalePreference
|
||||
use MakesHash;
|
||||
use PresentableTrait;
|
||||
use SoftDeletes;
|
||||
|
||||
use HasFactory;
|
||||
|
||||
/* Used to authenticate a contact */
|
||||
protected $guard = 'contact';
|
||||
|
||||
@ -198,4 +200,20 @@ class ClientContact extends Authenticatable implements HasLocalePreference
|
||||
|
||||
return asset('images/svg/user.svg');
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a convenience login click for contacts to bypass the
|
||||
* contact authentication layer
|
||||
*
|
||||
* @return string URL
|
||||
*/
|
||||
public function getLoginLink()
|
||||
{
|
||||
|
||||
$domain = isset($this->company->portal_domain) ?: $this->company->domain();
|
||||
|
||||
return $domain . 'client/key_login/' . $this->contact_key;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ class Company extends BaseModel
|
||||
public function domain()
|
||||
{
|
||||
if (Ninja::isNinja()) {
|
||||
return $this->subdomain.config('ninja.app_domain');
|
||||
return $this->subdomain . config('ninja.app_domain');
|
||||
}
|
||||
|
||||
return config('ninja.app_url');
|
||||
|
@ -72,13 +72,15 @@ class Gateway extends StaticModel
|
||||
$link = 'https://dashboard.stripe.com/account/apikeys';
|
||||
}
|
||||
|
||||
$key = 'texts.gateway_help_'.$this->id;
|
||||
$str = trans($key, [
|
||||
'link' => "<a href='$link' >Click here</a>",
|
||||
'complete_link' => url('/complete'),
|
||||
]);
|
||||
// $key = 'texts.gateway_help_'.$this->id;
|
||||
// $str = trans($key, [
|
||||
// 'link' => "<a href='$link' >Click here</a>",
|
||||
// 'complete_link' => url('/complete'),
|
||||
// ]);
|
||||
|
||||
return $key != $str ? $str : '';
|
||||
return $link;
|
||||
|
||||
//return $key != $str ? $str : '';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ use App\Utils\Traits\UserSessionAttributes;
|
||||
use App\Utils\Traits\UserSettings;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Contracts\Translation\HasLocalePreference;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
@ -40,7 +41,8 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
use UserSettings;
|
||||
use Filterable;
|
||||
use \Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
use HasFactory;
|
||||
|
||||
protected $guard = 'user';
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
@ -14,12 +14,13 @@ namespace App\Models;
|
||||
use App\Models\Company;
|
||||
use App\Models\Language;
|
||||
use App\Models\User;
|
||||
use App\Notifications\ClientContactResetPassword;
|
||||
use App\Notifications\ClientContactResetPassword as ResetPasswordNotification;
|
||||
use App\Notifications\ClientContactResetPassword;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Hashids\Hashids;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Contracts\Translation\HasLocalePreference;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
@ -33,6 +34,7 @@ class VendorContact extends Authenticatable implements HasLocalePreference
|
||||
use MakesHash;
|
||||
use PresentableTrait;
|
||||
use SoftDeletes;
|
||||
use HasFactory;
|
||||
|
||||
/* Used to authenticate a vendor */
|
||||
protected $guard = 'vendor';
|
||||
|
@ -47,6 +47,7 @@ class ClientContactTransformer extends EntityTransformer
|
||||
'send_email' => (bool) $contact->send_email,
|
||||
'last_login' => (int) $contact->last_login,
|
||||
'password' => empty($contact->password) ? '' : '**********',
|
||||
'link' => $contact->getLoginLink(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,18 @@ use App\Models\Client;
|
||||
|
||||
class Helpers
|
||||
{
|
||||
public static function sharedEmailVariables(Client $client, array $settings = null): array
|
||||
public static function sharedEmailVariables(?Client $client, array $settings = null): array
|
||||
{
|
||||
if(!$client){
|
||||
|
||||
$elements['signature'] = '';
|
||||
$elements['settings'] = new \stdClass;
|
||||
$elements['whitelabel'] = true;
|
||||
|
||||
return $elements;
|
||||
|
||||
}
|
||||
|
||||
$_settings = is_null($settings) ? $client->getMergedSettings() : $settings;
|
||||
|
||||
$elements['signature'] = $_settings->email_signature;
|
||||
|
@ -162,7 +162,7 @@ class HtmlEngine
|
||||
$data['$quote.amount'] = ['value' => Number::formatMoney($this->entity_calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.quote_total')];
|
||||
$data['$credit.total'] = ['value' => Number::formatMoney($this->entity_calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_total')];
|
||||
$data['$credit.number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.credit_number')];
|
||||
$data['$credit.amount'] = &$data['$credit.total'];
|
||||
$data['$credit.total'] = &$data['$credit.total'];
|
||||
$data['$credit.po_number'] = &$data['$invoice.po_number'];
|
||||
$data['$credit.date'] = ['value' => $this->entity->date, 'label' => ctrans('texts.credit_date')];
|
||||
$data['$balance'] = ['value' => Number::formatMoney($this->entity_calc->getBalance(), $this->client) ?: ' ', 'label' => ctrans('texts.balance')];
|
||||
|
@ -253,7 +253,7 @@ trait MakesInvoiceValues
|
||||
$data['$quote.amount'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.quote_total')];
|
||||
$data['$credit.total'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_total')];
|
||||
$data['$credit.number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.credit_number')];
|
||||
$data['$credit.amount'] = &$data['$credit.total'];
|
||||
$data['$credit.total'] = &$data['$credit.total'];
|
||||
$data['$credit.po_number'] = &$data['$invoice.po_number'];
|
||||
$data['$credit.date'] = ['value' => $this->date, 'label' => ctrans('texts.credit_date')];
|
||||
$data['$balance'] = ['value' => Number::formatMoney($calc->getBalance(), $this->client) ?: ' ', 'label' => ctrans('texts.balance')];
|
||||
|
@ -96,7 +96,7 @@ trait MakesTemplateData
|
||||
$data['$quote_total'] = ['value' => '$100.00', 'label' => ctrans('texts.quote_total')];
|
||||
$data['$quote.amount'] = &$data['$quote_total'];
|
||||
$data['$credit_total'] = ['value' => '$100.00', 'label' => ctrans('texts.credit_total')];
|
||||
$data['$credit.amount'] = &$data['$credit_total'];
|
||||
$data['$credit.total'] = &$data['$credit_total'];
|
||||
$data['$balance'] = ['value' => '$100.00', 'label' => ctrans('texts.balance')];
|
||||
$data['$invoice.balance'] = &$data['$balance'];
|
||||
$data['$taxes'] = ['value' => '$10.00', 'label' => ctrans('texts.taxes')];
|
||||
|
@ -53,8 +53,12 @@ trait HasRecurrence
|
||||
*/
|
||||
public function setDayOfMonth($date, $day_of_month)
|
||||
{
|
||||
info($date);
|
||||
|
||||
$carbon_date = Carbon::parse($date);
|
||||
|
||||
info($carbon_date);
|
||||
|
||||
$set_date = $carbon_date->copy()->setUnitNoOverflow('day', $day_of_month, 'month');
|
||||
|
||||
//If the set date is less than the original date we need to add a month.
|
||||
|
@ -3,7 +3,13 @@
|
||||
"description": "Invoices, expenses & time-tracking built with Laravel",
|
||||
"keywords": [
|
||||
"invoice",
|
||||
"laravel"
|
||||
"laravel",
|
||||
"invoicing",
|
||||
"time tracking",
|
||||
"expenses",
|
||||
"CRM",
|
||||
"Credit card billing",
|
||||
"projects"
|
||||
],
|
||||
"license": "Attribution Assurance License",
|
||||
"authors": [
|
||||
@ -26,19 +32,19 @@
|
||||
"cleverit/ubl_invoice": "^1.3",
|
||||
"composer/composer": "^1.10",
|
||||
"czproject/git-php": "^3.17",
|
||||
"dacastro4/laravel-gmail": "^4.0",
|
||||
"turbo124/laravel-gmail": "^5.0",
|
||||
"doctrine/dbal": "^2.10",
|
||||
"fedeisas/laravel-mail-css-inliner": "^3",
|
||||
"fideloper/proxy": "^4.2",
|
||||
"fzaninotto/faker": "^1.4",
|
||||
"google/apiclient": "^2.7",
|
||||
"guzzlehttp/guzzle": "^6.5",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"hashids/hashids": "^3.0",
|
||||
"intervention/image": "^2.5",
|
||||
"laracasts/presenter": "^0.2.1",
|
||||
"laravel/framework": "^7.27",
|
||||
"laravel/framework": "^8.0",
|
||||
"laravel/slack-notification-channel": "^2.2",
|
||||
"laravel/socialite": "^4.4",
|
||||
"laravel/socialite": "^5",
|
||||
"laravel/tinker": "^2.0",
|
||||
"league/flysystem-aws-s3-v3": "~1.0",
|
||||
"league/flysystem-cached-adapter": "^1.1",
|
||||
@ -49,33 +55,31 @@
|
||||
"nwidart/laravel-modules": "^6.0",
|
||||
"omnipay/paypal": "^3.0",
|
||||
"predis/predis": "^1.1",
|
||||
"sentry/sentry-laravel": "^1.8",
|
||||
"sentry/sentry-laravel": "^2",
|
||||
"spatie/browsershot": "^3.37",
|
||||
"staudenmeir/eloquent-has-many-deep": "^1.11",
|
||||
"stripe/stripe-php": "^7.50",
|
||||
"turbo124/beacon": "^1",
|
||||
"webpatser/laravel-countries": "dev-master#75992ad",
|
||||
"laravel/ui": "^2.0"
|
||||
"laravel/ui": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"wildbit/postmark-php": "^2.6",
|
||||
"wildbit/postmark-php": "^4.0",
|
||||
"anahkiasen/former": "^4.2",
|
||||
"barryvdh/laravel-debugbar": "^3.4",
|
||||
"darkaonline/l5-swagger": "^7.0",
|
||||
"darkaonline/l5-swagger": "^8.0",
|
||||
"filp/whoops": "^2.7",
|
||||
"mockery/mockery": "^1.3.1",
|
||||
"nunomaduro/collision": "^4.1",
|
||||
"phpunit/phpunit": "^8.5",
|
||||
"nunomaduro/collision": "^5.0",
|
||||
"phpunit/phpunit": "^9.0",
|
||||
"fzaninotto/faker": "^1.9.1",
|
||||
"facade/ignition": "^2.0"
|
||||
"facade/ignition": "^2.3.6"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"database/seeds",
|
||||
"database/factories"
|
||||
],
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
},
|
||||
"files": [
|
||||
"app/Libraries/OFX.php"
|
||||
|
2011
composer.lock
generated
2011
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -29,7 +29,8 @@ return [
|
||||
'enabled_modules' => 32767,
|
||||
'phantomjs_key' => env('PHANTOMJS_KEY', false),
|
||||
'phantomjs_secret' => env('PHANTOMJS_SECRET', false),
|
||||
|
||||
'trusted_proxies' => env('TRUSTED_PROXIES', false),
|
||||
|
||||
'sentry_dsn' => env('SENTRY_LARAVEL_DSN', 'https://9b4e15e575214354a7d666489783904a@sentry.invoicing.co/6'),
|
||||
'environment' => env('NINJA_ENVIRONMENT', 'selfhost'), // 'hosted', 'development', 'selfhost', 'reseller'
|
||||
|
||||
|
@ -1,12 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use App\Models\Account;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\Account::class, function (Faker $faker) {
|
||||
return [
|
||||
'default_company_id' => 1,
|
||||
'key' => Str::random(32),
|
||||
'report_errors' => 1,
|
||||
];
|
||||
});
|
||||
class AccountFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Account::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'default_company_id' => 1,
|
||||
'key' => Str::random(32),
|
||||
'report_errors' => 1,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,28 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use App\Models\Account;
|
||||
use App\Models\ClientContact;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This directory should contain each of the model factory definitions for
|
||||
| your application. Factories provide a convenient way to generate new
|
||||
| model instances for testing / seeding your application's database.
|
||||
|
|
||||
*/
|
||||
class ClientContactFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = ClientContact::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'first_name' => $this->faker->firstName,
|
||||
'last_name' => $this->faker->lastName,
|
||||
'phone' => $this->faker->phoneNumber,
|
||||
'email_verified_at' => now(),
|
||||
'email' => $this->faker->unique()->safeEmail,
|
||||
'send_email' => true,
|
||||
'password' => bcrypt('password'),
|
||||
'remember_token' => \Illuminate\Support\Str::random(10),
|
||||
'contact_key' => \Illuminate\Support\Str::random(40),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$factory->define(App\Models\ClientContact::class, function (Faker $faker) {
|
||||
return [
|
||||
'first_name' => $faker->firstName,
|
||||
'last_name' => $faker->lastName,
|
||||
'phone' => $faker->phoneNumber,
|
||||
'email_verified_at' => now(),
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'send_email' => true,
|
||||
'password' => bcrypt('password'),
|
||||
'remember_token' => \Illuminate\Support\Str::random(10),
|
||||
'contact_key' => \Illuminate\Support\Str::random(40),
|
||||
];
|
||||
});
|
||||
|
@ -1,35 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use Faker\Generator as Faker;
|
||||
use App\Models\Client;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\Client::class, function (Faker $faker) {
|
||||
return [
|
||||
'name' => $faker->company(),
|
||||
'website' => $faker->url,
|
||||
'private_notes' => $faker->text(200),
|
||||
'balance' => 0,
|
||||
'paid_to_date' => 0,
|
||||
'vat_number' => $faker->numberBetween(123456789, 987654321),
|
||||
'id_number' => '',
|
||||
'custom_value1' => '',
|
||||
'custom_value2' => '',
|
||||
'custom_value3' => '',
|
||||
'custom_value4' => '',
|
||||
'address1' => $faker->buildingNumber,
|
||||
'address2' => $faker->streetAddress,
|
||||
'city' => $faker->city,
|
||||
'state' => $faker->state,
|
||||
'postal_code' => $faker->postcode,
|
||||
'country_id' => 4,
|
||||
'shipping_address1' => $faker->buildingNumber,
|
||||
'shipping_address2' => $faker->streetAddress,
|
||||
'shipping_city' => $faker->city,
|
||||
'shipping_state' => $faker->state,
|
||||
'shipping_postal_code' => $faker->postcode,
|
||||
'shipping_country_id' => 4,
|
||||
'settings' => ClientSettings::defaults(),
|
||||
'client_hash' => \Illuminate\Support\Str::random(40),
|
||||
];
|
||||
});
|
||||
class ClientFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Client::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
|
||||
return [
|
||||
'name' => $this->faker->company(),
|
||||
'website' => $this->faker->url,
|
||||
'private_notes' => $this->faker->text(200),
|
||||
'balance' => 0,
|
||||
'paid_to_date' => 0,
|
||||
'vat_number' => $this->faker->numberBetween(123456789, 987654321),
|
||||
'id_number' => '',
|
||||
'custom_value1' => '',
|
||||
'custom_value2' => '',
|
||||
'custom_value3' => '',
|
||||
'custom_value4' => '',
|
||||
'address1' => $this->faker->buildingNumber,
|
||||
'address2' => $this->faker->streetAddress,
|
||||
'city' => $this->faker->city,
|
||||
'state' => $this->faker->state,
|
||||
'postal_code' => $this->faker->postcode,
|
||||
'country_id' => 4,
|
||||
'shipping_address1' => $this->faker->buildingNumber,
|
||||
'shipping_address2' => $this->faker->streetAddress,
|
||||
'shipping_city' => $this->faker->city,
|
||||
'shipping_state' => $this->faker->state,
|
||||
'shipping_postal_code' => $this->faker->postcode,
|
||||
'shipping_country_id' => 4,
|
||||
'settings' => ClientSettings::defaults(),
|
||||
'client_hash' => \Illuminate\Support\Str::random(40),
|
||||
];
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Models\ClientLocation::class, function (Faker $faker) {
|
||||
return [
|
||||
'address1' => $faker->buildingNumber,
|
||||
'address2' => $faker->streetAddress,
|
||||
'city' => $faker->city,
|
||||
'state' => $faker->state,
|
||||
'postal_code' => $faker->postcode,
|
||||
'country_id' => 4,
|
||||
'latitude' => $faker->latitude,
|
||||
'longitude' => $faker->longitude,
|
||||
'description' => $faker->paragraph,
|
||||
'private_notes' => $faker->paragraph,
|
||||
];
|
||||
});
|
@ -1,29 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
|
||||
use App\DataMapper\CompanySettings;
|
||||
use Faker\Generator as Faker;
|
||||
use App\Models\Company;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\Company::class, function (Faker $faker) {
|
||||
return [
|
||||
//'name' => $faker->name,
|
||||
'company_key' => strtolower(\Illuminate\Support\Str::random(config('ninja.key_length'))),
|
||||
'ip' => $faker->ipv4,
|
||||
'db' => config('database.default'),
|
||||
'settings' => CompanySettings::defaults(),
|
||||
'is_large' => false,
|
||||
'custom_fields' => (object) [
|
||||
//'invoice1' => 'Custom Date|date',
|
||||
// 'invoice2' => '2|switch',
|
||||
// 'invoice3' => '3|',
|
||||
// 'invoice4' => '4',
|
||||
// 'client1'=>'1',
|
||||
// 'client2'=>'2',
|
||||
// 'client3'=>'3|date',
|
||||
// 'client4'=>'4|switch',
|
||||
// 'company1'=>'1|date',
|
||||
// 'company2'=>'2|switch',
|
||||
// 'company3'=>'3',
|
||||
// 'company4'=>'4',
|
||||
],
|
||||
];
|
||||
});
|
||||
class CompanyFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Company::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//'name' => $this->faker->name,
|
||||
'company_key' => strtolower(\Illuminate\Support\Str::random(config('ninja.key_length'))),
|
||||
'ip' => $this->faker->ipv4,
|
||||
'db' => config('database.default'),
|
||||
'settings' => CompanySettings::defaults(),
|
||||
'is_large' => false,
|
||||
'custom_fields' => (object) [
|
||||
//'invoice1' => 'Custom Date|date',
|
||||
// 'invoice2' => '2|switch',
|
||||
// 'invoice3' => '3|',
|
||||
// 'invoice4' => '4',
|
||||
// 'client1'=>'1',
|
||||
// 'client2'=>'2',
|
||||
// 'client3'=>'3|date',
|
||||
// 'client4'=>'4|switch',
|
||||
// 'company1'=>'1|date',
|
||||
// 'company2'=>'2|switch',
|
||||
// 'company3'=>'3',
|
||||
// 'company4'=>'4',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\Factory\InvoiceItemFactory;
|
||||
use Faker\Generator as Faker;
|
||||
use App\Models\Credit;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\Credit::class, function (Faker $faker) {
|
||||
return [
|
||||
'status_id' => App\Models\Credit::STATUS_DRAFT,
|
||||
'discount' => $faker->numberBetween(1, 10),
|
||||
'is_amount_discount' => (bool) random_int(0, 1),
|
||||
'tax_name1' => 'GST',
|
||||
'tax_rate1' => 10,
|
||||
'tax_name2' => 'VAT',
|
||||
'tax_rate2' => 17.5,
|
||||
//'tax_name3' => 'THIRDTAX',
|
||||
//'tax_rate3' => 5,
|
||||
// 'custom_value1' => $faker->numberBetween(1,4),
|
||||
// 'custom_value2' => $faker->numberBetween(1,4),
|
||||
// 'custom_value3' => $faker->numberBetween(1,4),
|
||||
// 'custom_value4' => $faker->numberBetween(1,4),
|
||||
'is_deleted' => false,
|
||||
'po_number' => $faker->text(10),
|
||||
'date' => $faker->date(),
|
||||
'due_date' => $faker->date(),
|
||||
'line_items' => InvoiceItemFactory::generateCredit(5),
|
||||
'terms' => $faker->text(500),
|
||||
];
|
||||
});
|
||||
class CreditFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Credit::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'status_id' => Credit::STATUS_DRAFT,
|
||||
'discount' => $this->faker->numberBetween(1, 10),
|
||||
'is_amount_discount' => (bool) random_int(0, 1),
|
||||
'tax_name1' => 'GST',
|
||||
'tax_rate1' => 10,
|
||||
'tax_name2' => 'VAT',
|
||||
'tax_rate2' => 17.5,
|
||||
//'tax_name3' => 'THIRDTAX',
|
||||
//'tax_rate3' => 5,
|
||||
// 'custom_value1' => $this->faker->numberBetween(1,4),
|
||||
// 'custom_value2' => $this->faker->numberBetween(1,4),
|
||||
// 'custom_value3' => $this->faker->numberBetween(1,4),
|
||||
// 'custom_value4' => $this->faker->numberBetween(1,4),
|
||||
'is_deleted' => false,
|
||||
'po_number' => $this->faker->text(10),
|
||||
'date' => $this->faker->date(),
|
||||
'due_date' => $this->faker->date(),
|
||||
'line_items' => InvoiceItemFactory::generateCredit(5),
|
||||
'terms' => $this->faker->text(500),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\Factory\InvoiceItemFactory;
|
||||
use Faker\Generator as Faker;
|
||||
use App\Models\Expense;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\Expense::class, function (Faker $faker) {
|
||||
return [
|
||||
'amount' => $faker->numberBetween(1, 10),
|
||||
'custom_value1' => $faker->text(10),
|
||||
'custom_value2' => $faker->text(10),
|
||||
'custom_value3' => $faker->text(10),
|
||||
'custom_value4' => $faker->text(10),
|
||||
'exchange_rate' => $faker->randomFloat(2, 0, 1),
|
||||
'expense_date' => $faker->date(),
|
||||
'is_deleted' => false,
|
||||
'public_notes' => $faker->text(50),
|
||||
'private_notes' => $faker->text(50),
|
||||
'transaction_reference' => $faker->text(5),
|
||||
];
|
||||
});
|
||||
class ExpenseFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Expense::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'amount' => $this->faker->numberBetween(1, 10),
|
||||
'custom_value1' => $this->faker->text(10),
|
||||
'custom_value2' => $this->faker->text(10),
|
||||
'custom_value3' => $this->faker->text(10),
|
||||
'custom_value4' => $this->faker->text(10),
|
||||
'exchange_rate' => $this->faker->randomFloat(2, 0, 1),
|
||||
'expense_date' => $this->faker->date(),
|
||||
'is_deleted' => false,
|
||||
'public_notes' => $this->faker->text(50),
|
||||
'private_notes' => $this->faker->text(50),
|
||||
'transaction_reference' => $this->faker->text(5),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use App\Models\Gateway;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\Gateway::class, function (Faker $faker) {
|
||||
return [
|
||||
'key' => '3b6621f970ab18887c4f6dca78d3f8bb',
|
||||
'visible' => true,
|
||||
'sort_order' =>1,
|
||||
'name' => 'demo',
|
||||
'provider' => 'test',
|
||||
'is_offsite' => true,
|
||||
'is_secure' => true,
|
||||
'fields' => '',
|
||||
'default_gateway_type_id' => 1,
|
||||
];
|
||||
});
|
||||
class GatewayFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Gateway::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'key' => '3b6621f970ab18887c4f6dca78d3f8bb',
|
||||
'visible' => true,
|
||||
'sort_order' =>1,
|
||||
'name' => 'demo',
|
||||
'provider' => 'test',
|
||||
'is_offsite' => true,
|
||||
'is_secure' => true,
|
||||
'fields' => '',
|
||||
'default_gateway_type_id' => 1,
|
||||
];
|
||||
}
|
||||
}
|
@ -1,31 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\Factory\InvoiceItemFactory;
|
||||
use Faker\Generator as Faker;
|
||||
use App\Models\Invoice;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\Invoice::class, function (Faker $faker) {
|
||||
return [
|
||||
'status_id' => App\Models\Invoice::STATUS_SENT,
|
||||
'number' => $faker->ean13(),
|
||||
'discount' => $faker->numberBetween(1, 10),
|
||||
'is_amount_discount' => (bool) random_int(0, 1),
|
||||
'tax_name1' => 'GST',
|
||||
'tax_rate1' => 10,
|
||||
'tax_name2' => 'VAT',
|
||||
'tax_rate2' => 17.5,
|
||||
//'tax_name3' => 'THIRDTAX',
|
||||
//'tax_rate3' => 5,
|
||||
'custom_value1' => $faker->date,
|
||||
'custom_value2' => rand(0, 1) ? 'yes' : 'no',
|
||||
// 'custom_value3' => $faker->numberBetween(1,4),
|
||||
// 'custom_value4' => $faker->numberBetween(1,4),
|
||||
'is_deleted' => false,
|
||||
'po_number' => $faker->text(10),
|
||||
'date' => $faker->date(),
|
||||
'due_date' => $faker->date(),
|
||||
'line_items' => InvoiceItemFactory::generate(5),
|
||||
'terms' => $faker->text(500),
|
||||
];
|
||||
});
|
||||
class InvoiceFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Invoice::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'status_id' => Invoice::STATUS_SENT,
|
||||
'number' => $this->faker->ean13(),
|
||||
'discount' => $this->faker->numberBetween(1, 10),
|
||||
'is_amount_discount' => (bool) random_int(0, 1),
|
||||
'tax_name1' => 'GST',
|
||||
'tax_rate1' => 10,
|
||||
'tax_name2' => 'VAT',
|
||||
'tax_rate2' => 17.5,
|
||||
//'tax_name3' => 'THIRDTAX',
|
||||
//'tax_rate3' => 5,
|
||||
'custom_value1' => $this->faker->date,
|
||||
'custom_value2' => rand(0, 1) ? 'yes' : 'no',
|
||||
// 'custom_value3' => $this->faker->numberBetween(1,4),
|
||||
// 'custom_value4' => $this->faker->numberBetween(1,4),
|
||||
'is_deleted' => false,
|
||||
'po_number' => $this->faker->text(10),
|
||||
'date' => $this->faker->date(),
|
||||
'due_date' => $this->faker->date(),
|
||||
'line_items' => InvoiceItemFactory::generate(5),
|
||||
'terms' => $this->faker->text(500),
|
||||
];
|
||||
}
|
||||
}
|
@ -1,10 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\InvoiceInvitation::class, function (Faker $faker) {
|
||||
return [
|
||||
'key' => Str::random(40),
|
||||
];
|
||||
});
|
||||
class InvoiceInvitationFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = InvoiceInvitation::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'key' => Str::random(40),
|
||||
];
|
||||
}
|
||||
}
|
@ -1,17 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
|
||||
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\Models\Payment;
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\Payment::class, function (Faker $faker) {
|
||||
return [
|
||||
'is_deleted' => false,
|
||||
'amount' => $faker->numberBetween(1, 10),
|
||||
'date' => $faker->date(),
|
||||
'transaction_reference' => $faker->text(10),
|
||||
'type_id' => Payment::TYPE_CREDIT_CARD,
|
||||
'status_id' => Payment::STATUS_COMPLETED,
|
||||
];
|
||||
});
|
||||
class PaymentFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Payment::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'is_deleted' => false,
|
||||
'amount' => $this->faker->numberBetween(1, 10),
|
||||
'date' => $this->faker->date(),
|
||||
'transaction_reference' => $this->faker->text(10),
|
||||
'type_id' => Payment::TYPE_CREDIT_CARD,
|
||||
'status_id' => Payment::STATUS_COMPLETED,
|
||||
];
|
||||
}
|
||||
}
|
@ -1,24 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Models\Product::class, function (Faker $faker) {
|
||||
return [
|
||||
'product_key' => $faker->text(7),
|
||||
'notes' => $faker->text(20),
|
||||
'cost' => $faker->numberBetween(1, 1000),
|
||||
'price' => $faker->numberBetween(1, 1000),
|
||||
'quantity' => $faker->numberBetween(1, 100),
|
||||
'tax_name1' => 'GST',
|
||||
'tax_rate1' => 10,
|
||||
'tax_name2' => 'VAT',
|
||||
'tax_rate2' => 17.5,
|
||||
'tax_name3' => 'THIRDTAX',
|
||||
'tax_rate3' => 5,
|
||||
'custom_value1' => $faker->text(20),
|
||||
'custom_value2' => $faker->text(20),
|
||||
'custom_value3' => $faker->text(20),
|
||||
'custom_value4' => $faker->text(20),
|
||||
'is_deleted' => false,
|
||||
];
|
||||
});
|
||||
use App\Models\Product;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ProductFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Product::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'product_key' => $this->faker->text(7),
|
||||
'notes' => $this->faker->text(20),
|
||||
'cost' => $this->faker->numberBetween(1, 1000),
|
||||
'price' => $this->faker->numberBetween(1, 1000),
|
||||
'quantity' => $this->faker->numberBetween(1, 100),
|
||||
'tax_name1' => 'GST',
|
||||
'tax_rate1' => 10,
|
||||
'tax_name2' => 'VAT',
|
||||
'tax_rate2' => 17.5,
|
||||
'tax_name3' => 'THIRDTAX',
|
||||
'tax_rate3' => 5,
|
||||
'custom_value1' => $this->faker->text(20),
|
||||
'custom_value2' => $this->faker->text(20),
|
||||
'custom_value3' => $this->faker->text(20),
|
||||
'custom_value4' => $this->faker->text(20),
|
||||
'is_deleted' => false,
|
||||
];
|
||||
}
|
||||
}
|
@ -1,12 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Models\Project::class, function (Faker $faker) {
|
||||
return [
|
||||
'name' => $faker->name(),
|
||||
'description' => $faker->text(50),
|
||||
];
|
||||
});
|
||||
|
||||
use App\Models\Project;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ProjectFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Project::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->name(),
|
||||
'description' => $this->faker->text(50),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Models\Quote::class, function (Faker $faker) {
|
||||
return [
|
||||
'status_id' => App\Models\Quote::STATUS_DRAFT,
|
||||
'discount' => $faker->numberBetween(1, 10),
|
||||
'is_amount_discount' => $faker->boolean(),
|
||||
'tax_name1' => 'GST',
|
||||
'tax_rate1' => 10,
|
||||
'tax_name2' => 'VAT',
|
||||
'tax_rate2' => 17.5,
|
||||
'tax_name3' => 'THIRDTAX',
|
||||
'tax_rate3' => 5,
|
||||
// 'custom_value1' => $faker->numberBetween(1, 4),
|
||||
// 'custom_value2' => $faker->numberBetween(1, 4),
|
||||
// 'custom_value3' => $faker->numberBetween(1, 4),
|
||||
// 'custom_value4' => $faker->numberBetween(1, 4),
|
||||
'is_deleted' => false,
|
||||
'po_number' => $faker->text(10),
|
||||
'line_items' => false,
|
||||
];
|
||||
});
|
||||
use App\Models\Quote;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class QuoteFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Quote::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'status_id' => Quote::STATUS_DRAFT,
|
||||
'discount' => $this->faker->numberBetween(1, 10),
|
||||
'is_amount_discount' => $this->faker->boolean(),
|
||||
'tax_name1' => 'GST',
|
||||
'tax_rate1' => 10,
|
||||
'tax_name2' => 'VAT',
|
||||
'tax_rate2' => 17.5,
|
||||
'tax_name3' => 'THIRDTAX',
|
||||
'tax_rate3' => 5,
|
||||
// 'custom_value1' => $this->faker->numberBetween(1, 4),
|
||||
// 'custom_value2' => $this->faker->numberBetween(1, 4),
|
||||
// 'custom_value3' => $this->faker->numberBetween(1, 4),
|
||||
// 'custom_value4' => $this->faker->numberBetween(1, 4),
|
||||
'is_deleted' => false,
|
||||
'po_number' => $this->faker->text(10),
|
||||
'line_items' => false,
|
||||
];
|
||||
}
|
||||
}
|
@ -1,10 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
use App\Models\QuoteInvitation;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\QuoteInvitation::class, function (Faker $faker) {
|
||||
return [
|
||||
'key' => Str::random(40),
|
||||
];
|
||||
});
|
||||
class QuoteInvitationFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = QuoteInvitation::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'key' => Str::random(40),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Models\RecurringInvoice::class, function (Faker $faker) {
|
||||
return [
|
||||
'status_id' => App\Models\RecurringInvoice::STATUS_ACTIVE,
|
||||
'discount' => $faker->numberBetween(1, 10),
|
||||
'is_amount_discount' => $faker->boolean(),
|
||||
'tax_name1' => 'GST',
|
||||
'tax_rate1' => 10,
|
||||
'tax_name2' => 'VAT',
|
||||
'tax_rate2' => 17.5,
|
||||
'tax_name3' => 'THIRDTAX',
|
||||
'tax_rate3' => 5,
|
||||
'custom_value1' => $faker->numberBetween(1, 4),
|
||||
'custom_value2' => $faker->numberBetween(1, 4),
|
||||
'custom_value3' => $faker->numberBetween(1, 4),
|
||||
'custom_value4' => $faker->numberBetween(1, 4),
|
||||
'is_deleted' => false,
|
||||
'po_number' => $faker->text(10),
|
||||
'date' => $faker->date(),
|
||||
'due_date' => $faker->date(),
|
||||
'line_items' => false,
|
||||
'frequency_id' => App\Models\RecurringInvoice::FREQUENCY_MONTHLY,
|
||||
'last_sent_date' => now()->subMonth(),
|
||||
'next_send_date' => now()->addMonthNoOverflow(),
|
||||
'remaining_cycles' => $faker->numberBetween(1, 10),
|
||||
'amount' => $faker->randomFloat(2, $min = 1, $max = 1000), // 48.8932
|
||||
use App\Models\RecurringInvoice;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
];
|
||||
});
|
||||
class RecurringInvoiceFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = RecurringInvoice::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'status_id' => RecurringInvoice::STATUS_ACTIVE,
|
||||
'discount' => $this->faker->numberBetween(1, 10),
|
||||
'is_amount_discount' => $this->faker->boolean(),
|
||||
'tax_name1' => 'GST',
|
||||
'tax_rate1' => 10,
|
||||
'tax_name2' => 'VAT',
|
||||
'tax_rate2' => 17.5,
|
||||
'tax_name3' => 'THIRDTAX',
|
||||
'tax_rate3' => 5,
|
||||
'custom_value1' => $this->faker->numberBetween(1, 4),
|
||||
'custom_value2' => $this->faker->numberBetween(1, 4),
|
||||
'custom_value3' => $this->faker->numberBetween(1, 4),
|
||||
'custom_value4' => $this->faker->numberBetween(1, 4),
|
||||
'is_deleted' => false,
|
||||
'po_number' => $this->faker->text(10),
|
||||
'date' => $this->faker->date(),
|
||||
'due_date' => $this->faker->date(),
|
||||
'line_items' => false,
|
||||
'frequency_id' => RecurringInvoice::FREQUENCY_MONTHLY,
|
||||
'last_sent_date' => now()->subMonth(),
|
||||
'next_send_date' => now()->addMonthNoOverflow(),
|
||||
'remaining_cycles' => $this->faker->numberBetween(1, 10),
|
||||
'amount' => $this->faker->randomFloat(2, $min = 1, $max = 1000), // 48.8932
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use Faker\Generator as Faker;
|
||||
use App\Models\QuoteInvitation;
|
||||
use App\Models\RecurringQuote;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\RecurringQuote::class, function (Faker $faker) {
|
||||
return [
|
||||
'status_id' => App\Models\RecurringQuote::STATUS_DRAFT,
|
||||
'number' => $faker->text(256),
|
||||
'discount' => $faker->numberBetween(1, 10),
|
||||
'is_amount_discount' => $faker->boolean(),
|
||||
'tax_name1' => 'GST',
|
||||
'tax_rate1' => 10,
|
||||
'tax_name2' => 'VAT',
|
||||
'tax_rate2' => 17.5,
|
||||
'tax_name3' => 'THIRDTAX',
|
||||
'tax_rate3' => 5,
|
||||
'custom_value1' => $faker->numberBetween(1, 4),
|
||||
'custom_value2' => $faker->numberBetween(1, 4),
|
||||
'custom_value3' => $faker->numberBetween(1, 4),
|
||||
'custom_value4' => $faker->numberBetween(1, 4),
|
||||
'is_deleted' => false,
|
||||
'po_number' => $faker->text(10),
|
||||
'date' => $faker->date(),
|
||||
'due_date' => $faker->date(),
|
||||
'line_items' => false,
|
||||
'frequency_id' => App\Models\RecurringQuote::FREQUENCY_MONTHLY,
|
||||
'start_date' => $faker->date(),
|
||||
'last_sent_date' => $faker->date(),
|
||||
'next_send_date' => $faker->date(),
|
||||
'remaining_cycles' => $faker->numberBetween(1, 10),
|
||||
];
|
||||
});
|
||||
class RecurringQuoteFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = RecurringQuote::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'status_id' => RecurringQuote::STATUS_DRAFT,
|
||||
'number' => $this->faker->text(256),
|
||||
'discount' => $this->faker->numberBetween(1, 10),
|
||||
'is_amount_discount' => $this->faker->boolean(),
|
||||
'tax_name1' => 'GST',
|
||||
'tax_rate1' => 10,
|
||||
'tax_name2' => 'VAT',
|
||||
'tax_rate2' => 17.5,
|
||||
'tax_name3' => 'THIRDTAX',
|
||||
'tax_rate3' => 5,
|
||||
'custom_value1' => $this->faker->numberBetween(1, 4),
|
||||
'custom_value2' => $this->faker->numberBetween(1, 4),
|
||||
'custom_value3' => $this->faker->numberBetween(1, 4),
|
||||
'custom_value4' => $this->faker->numberBetween(1, 4),
|
||||
'is_deleted' => false,
|
||||
'po_number' => $this->faker->text(10),
|
||||
'date' => $this->faker->date(),
|
||||
'due_date' => $this->faker->date(),
|
||||
'line_items' => false,
|
||||
'frequency_id' => RecurringQuote::FREQUENCY_MONTHLY,
|
||||
'start_date' => $this->faker->date(),
|
||||
'last_sent_date' => $this->faker->date(),
|
||||
'next_send_date' => $this->faker->date(),
|
||||
'remaining_cycles' => $this->faker->numberBetween(1, 10),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Models\Task::class, function (Faker $faker) {
|
||||
return [
|
||||
'description' => $faker->text(50),
|
||||
];
|
||||
});
|
||||
use App\Models\Task;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class TaskFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Task::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'description' => $this->faker->text(50),
|
||||
];
|
||||
}
|
||||
}
|
@ -1,26 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This directory should contain each of the model factory definitions for
|
||||
| your application. Factories provide a convenient way to generate new
|
||||
| model instances for testing / seeding your application's database.
|
||||
|
|
||||
*/
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\User::class, function (Faker $faker) {
|
||||
return [
|
||||
'first_name' => $faker->name,
|
||||
'last_name' => $faker->name,
|
||||
'phone' => $faker->phoneNumber,
|
||||
'email' => config('ninja.testvars.username'),
|
||||
'email_verified_at' => now(),
|
||||
'password' => bcrypt(config('ninja.testvars.password')), // secret
|
||||
'remember_token' => \Illuminate\Support\Str::random(10),
|
||||
];
|
||||
});
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = User::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'first_name' => $this->faker->name,
|
||||
'last_name' => $this->faker->name,
|
||||
'phone' => $this->faker->phoneNumber,
|
||||
'email' => config('ninja.testvars.username'),
|
||||
'email_verified_at' => now(),
|
||||
'password' => bcrypt(config('ninja.testvars.password')), // secret
|
||||
'remember_token' => \Illuminate\Support\Str::random(10),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This directory should contain each of the model factory definitions for
|
||||
| your application. Factories provide a convenient way to generate new
|
||||
| model instances for testing / seeding your application's database.
|
||||
|
|
||||
*/
|
||||
use App\Models\VendorContact;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\VendorContact::class, function (Faker $faker) {
|
||||
return [
|
||||
'first_name' => $faker->firstName,
|
||||
'last_name' => $faker->lastName,
|
||||
'phone' => $faker->phoneNumber,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
];
|
||||
});
|
||||
class VendorContactFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = VendorContact::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'first_name' => $this->faker->firstName,
|
||||
'last_name' => $this->faker->lastName,
|
||||
'phone' => $this->faker->phoneNumber,
|
||||
'email' => $this->faker->unique()->safeEmail,
|
||||
];
|
||||
}
|
||||
}
|
@ -1,23 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Factories;
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use App\Models\Vendor;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\Vendor::class, function (Faker $faker) {
|
||||
return [
|
||||
'name' => $faker->name(),
|
||||
'website' => $faker->url,
|
||||
'private_notes' => $faker->text(200),
|
||||
'vat_number' => $faker->text(25),
|
||||
'id_number' => $faker->text(20),
|
||||
'custom_value1' => $faker->text(20),
|
||||
'custom_value2' => $faker->text(20),
|
||||
'custom_value3' => $faker->text(20),
|
||||
'custom_value4' => $faker->text(20),
|
||||
'address1' => $faker->buildingNumber,
|
||||
'address2' => $faker->streetAddress,
|
||||
'city' => $faker->city,
|
||||
'state' => $faker->state,
|
||||
'postal_code' => $faker->postcode,
|
||||
'country_id' => 4,
|
||||
];
|
||||
});
|
||||
class VendorFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Vendor::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->name(),
|
||||
'website' => $this->faker->url,
|
||||
'private_notes' => $this->faker->text(200),
|
||||
'vat_number' => $this->faker->text(25),
|
||||
'id_number' => $this->faker->text(20),
|
||||
'custom_value1' => $this->faker->text(20),
|
||||
'custom_value2' => $this->faker->text(20),
|
||||
'custom_value3' => $this->faker->text(20),
|
||||
'custom_value4' => $this->faker->text(20),
|
||||
'address1' => $this->faker->buildingNumber,
|
||||
'address2' => $this->faker->streetAddress,
|
||||
'city' => $this->faker->city,
|
||||
'state' => $this->faker->state,
|
||||
'postal_code' => $this->faker->postcode,
|
||||
'country_id' => 4,
|
||||
];
|
||||
}
|
||||
}
|
@ -17,8 +17,11 @@ class UpdateGatewayTableVisibleColumn extends Migration
|
||||
Gateway::query()->update(['visible' => 0]);
|
||||
|
||||
Gateway::whereIn('id', [1,15,20,39])->update(['visible' => 1]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
@ -1,13 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Bank;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class BanksSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
Eloquent::unguard();
|
||||
Model::unguard();
|
||||
|
||||
$this->createBanks();
|
||||
}
|
||||
@ -22,7 +33,7 @@ class BanksSeeder extends Seeder
|
||||
$banks = json_decode($banks);
|
||||
|
||||
foreach ($banks as $bank) {
|
||||
if (! DB::table('banks')->where('remote_id', '=', $bank->id)->count()) {
|
||||
if (! \DB::table('banks')->where('remote_id', '=', $bank->id)->count()) {
|
||||
if (! isset($bank->fid) || ! isset($bank->org)) {
|
||||
continue;
|
||||
}
|
@ -1,4 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\PaymentLibrary;
|
||||
use App\Models\Size;
|
@ -1,7 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Country;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Webpatser\Countries\Countries;
|
||||
|
||||
class CountriesSeeder extends Seeder
|
||||
{
|
||||
@ -12,9 +24,10 @@ class CountriesSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Eloquent::unguard();
|
||||
Model::unguard();
|
||||
|
||||
$countries = Countries::getList();
|
||||
$countries_object = new Countries;
|
||||
$countries = $countries_object->getList();
|
||||
|
||||
foreach ($countries as $countryId => $country) {
|
||||
if ($record = Country::whereCountryCode($country['country-code'])->first()) {
|
@ -1,13 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Seeders;
|
||||
|
||||
|
||||
use App\Models\Currency;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class CurrenciesSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
Eloquent::unguard();
|
||||
Model::unguard();
|
||||
|
||||
// http://www.localeplanet.com/icu/currency.html
|
||||
$currencies = [
|
63
database/seeders/DatabaseSeeder.php
Normal file
63
database/seeders/DatabaseSeeder.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Seeders;
|
||||
|
||||
|
||||
use App\Models\Timezone;
|
||||
use Database\Seeders\BanksSeeder;
|
||||
use Database\Seeders\ConstantsSeeder;
|
||||
use Database\Seeders\CountriesSeeder;
|
||||
use Database\Seeders\CurrenciesSeeder;
|
||||
use Database\Seeders\DateFormatsSeeder;
|
||||
use Database\Seeders\DesignSeeder;
|
||||
use Database\Seeders\GatewayTypesSeeder;
|
||||
use Database\Seeders\IndustrySeeder;
|
||||
use Database\Seeders\LanguageSeeder;
|
||||
use Database\Seeders\PaymentLibrariesSeeder;
|
||||
use Database\Seeders\PaymentTypesSeeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->command->info('Running DatabaseSeeder');
|
||||
|
||||
if (Timezone::count()) {
|
||||
$this->command->info('Skipping: already run');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Model::unguard();
|
||||
|
||||
$this->call([
|
||||
ConstantsSeeder::class,
|
||||
PaymentLibrariesSeeder::class,
|
||||
BanksSeeder::class,
|
||||
CurrenciesSeeder::class,
|
||||
LanguageSeeder::class,
|
||||
CountriesSeeder::class,
|
||||
IndustrySeeder::class,
|
||||
PaymentTypesSeeder::class,
|
||||
GatewayTypesSeeder::class,
|
||||
DateFormatsSeeder::class,
|
||||
DesignSeeder::class,
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
@ -1,14 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Seeders;
|
||||
|
||||
|
||||
use App\Models\DateFormat;
|
||||
use App\Models\DatetimeFormat;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DateFormatsSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
Eloquent::unguard();
|
||||
Model::unguard();
|
||||
|
||||
// Date formats
|
||||
$formats = [
|
@ -1,15 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Seeders;
|
||||
|
||||
|
||||
use App\Models\Bank;
|
||||
use App\Models\Design;
|
||||
use App\Services\PdfMaker\Design as PdfMakerDesign;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DesignSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
Eloquent::unguard();
|
||||
Model::unguard();
|
||||
|
||||
$this->createDesigns();
|
||||
}
|
@ -1,13 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Seeders;
|
||||
|
||||
|
||||
use App\Models\GatewayType;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class GatewayTypesSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
Eloquent::unguard();
|
||||
Model::unguard();
|
||||
|
||||
$gateway_types = [
|
||||
['id' => 1, 'alias' => 'credit_card', 'name' => 'Credit Card'],
|
@ -1,13 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Seeders;
|
||||
|
||||
|
||||
use App\Models\Industry;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class IndustrySeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
Eloquent::unguard();
|
||||
Model::unguard();
|
||||
|
||||
$industries = [
|
||||
['id' => 1, 'name' => 'Accounting & Legal'],
|
||||
@ -52,6 +64,5 @@ class IndustrySeeder extends Seeder
|
||||
}
|
||||
}
|
||||
|
||||
Eloquent::reguard();
|
||||
}
|
||||
}
|
@ -1,13 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Seeders;
|
||||
|
||||
|
||||
use App\Models\Language;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class LanguageSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
Eloquent::unguard();
|
||||
Model::unguard();
|
||||
|
||||
// https://github.com/caouecs/Laravel-lang
|
||||
// https://www.loc.gov/standards/iso639-2/php/code_list.php
|
||||
@ -53,6 +65,5 @@ class LanguageSeeder extends Seeder
|
||||
}
|
||||
}
|
||||
|
||||
Eloquent::reguard();
|
||||
}
|
||||
}
|
@ -1,14 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Seeders;
|
||||
|
||||
|
||||
use App\Models\Gateway;
|
||||
use App\Models\GatewayType;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PaymentLibrariesSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
Eloquent::unguard();
|
||||
Model::unguard();
|
||||
|
||||
$gateways = [
|
||||
['id' => 1, 'name' => 'Authorize.Net', 'provider' => 'Authorize', 'sort_order' => 5, 'key' => '3b6621f970ab18887c4f6dca78d3f8bb', 'fields' => '{"apiLoginId":"","transactionKey":"","testMode":false,"developerMode":false,"liveEndpoint":"https:\/\/api2.authorize.net\/xml\/v1\/request.api","developerEndpoint":"https:\/\/apitest.authorize.net\/xml\/v1\/request.api"}
|
||||
@ -81,5 +93,16 @@ class PaymentLibrariesSeeder extends Seeder
|
||||
Gateway::create($gateway);
|
||||
}
|
||||
}
|
||||
|
||||
Gateway::query()->update(['visible' => 0]);
|
||||
|
||||
Gateway::whereIn('id', [1,15,20,39])->update(['visible' => 1]);
|
||||
|
||||
Gateway::all()->each(function ($gateway){
|
||||
|
||||
$gateway->site_url = $gateway->getHelp();
|
||||
$gateway->save();
|
||||
|
||||
});
|
||||
}
|
||||
}
|
@ -1,13 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Seeders;
|
||||
|
||||
|
||||
use App\Models\PaymentTerm;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PaymentTermsSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
Eloquent::unguard();
|
||||
Model::unguard();
|
||||
|
||||
$paymentTerms = [
|
||||
['num_days' => 0, 'name' => 'Net 0'],
|
@ -1,6 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Seeders;
|
||||
|
||||
|
||||
use App\Models\PaymentType;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PaymentTypesSeeder extends Seeder
|
||||
@ -22,7 +34,7 @@ class PaymentTypesSeeder extends Seeder
|
||||
|
||||
public function run()
|
||||
{
|
||||
Eloquent::unguard();
|
||||
Model::unguard();
|
||||
|
||||
$paymentTypes = [
|
||||
// ['name' => 'Apply Credit'],
|
@ -1,4 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
@ -21,13 +31,16 @@ use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentHash;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\Product;
|
||||
use App\Models\Quote;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Models\User;
|
||||
use App\Models\UserAccount;
|
||||
use App\Repositories\CreditRepository;
|
||||
use App\Repositories\InvoiceRepository;
|
||||
use App\Repositories\QuoteRepository;
|
||||
use App\Utils\Ninja;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -72,19 +85,19 @@ class RandomDataSeeder extends Seeder
|
||||
|
||||
$this->command->info('Running RandomDataSeeder');
|
||||
|
||||
Eloquent::unguard();
|
||||
Model::unguard();
|
||||
|
||||
$faker = \Faker\Factory::create();
|
||||
|
||||
$account = factory(\App\Models\Account::class)->create();
|
||||
$company = factory(\App\Models\Company::class)->create([
|
||||
$account = Account::factory()->create();
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
]);
|
||||
|
||||
$account->default_company_id = $company->id;
|
||||
$account->save();
|
||||
|
||||
$user = factory(\App\Models\User::class)->create([
|
||||
$user = User::factory()->create([
|
||||
'email' => $faker->email,
|
||||
'account_id' => $account->id,
|
||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
||||
@ -111,7 +124,7 @@ class RandomDataSeeder extends Seeder
|
||||
$u2 = User::where('email', 'demo@invoiceninja.com')->first();
|
||||
|
||||
if (! $u2) {
|
||||
$u2 = factory(\App\Models\User::class)->create([
|
||||
$u2 = User::factory()->create([
|
||||
'email' => 'demo@invoiceninja.com',
|
||||
'password' => Hash::make('demo'),
|
||||
'account_id' => $account->id,
|
||||
@ -137,7 +150,7 @@ class RandomDataSeeder extends Seeder
|
||||
]);
|
||||
}
|
||||
|
||||
$client = factory(\App\Models\Client::class)->create([
|
||||
$client = Client::factory()->create([
|
||||
'user_id' => $user->id,
|
||||
'company_id' => $company->id,
|
||||
]);
|
||||
@ -155,15 +168,15 @@ class RandomDataSeeder extends Seeder
|
||||
'contact_key' => \Illuminate\Support\Str::random(40),
|
||||
]);
|
||||
|
||||
factory(\App\Models\Client::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) {
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
Client::factory()->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) {
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $company->id,
|
||||
'is_primary' => 1,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 5)->create([
|
||||
ClientContact::factory()->count(5)->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $company->id,
|
||||
@ -171,10 +184,10 @@ class RandomDataSeeder extends Seeder
|
||||
});
|
||||
|
||||
/* Product Factory */
|
||||
factory(\App\Models\Product::class, 2)->create(['user_id' => $user->id, 'company_id' => $company->id]);
|
||||
Product::factory()->count(2)->create(['user_id' => $user->id, 'company_id' => $company->id]);
|
||||
|
||||
/* Invoice Factory */
|
||||
factory(\App\Models\Invoice::class, 2)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]);
|
||||
Invoice::factory()->count(2)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]);
|
||||
|
||||
$invoices = Invoice::all();
|
||||
$invoice_repo = new InvoiceRepository();
|
||||
@ -228,7 +241,7 @@ class RandomDataSeeder extends Seeder
|
||||
});
|
||||
|
||||
/*Credits*/
|
||||
factory(\App\Models\Credit::class, 2)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]);
|
||||
Credit::factory()->count(2)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]);
|
||||
|
||||
$credits = Credit::cursor();
|
||||
$credit_repo = new CreditRepository();
|
||||
@ -253,12 +266,10 @@ class RandomDataSeeder extends Seeder
|
||||
});
|
||||
|
||||
/* Recurring Invoice Factory */
|
||||
factory(\App\Models\RecurringInvoice::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]);
|
||||
|
||||
// factory(\App\Models\Payment::class,20)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id, 'settings' => ClientSettings::buildClientSettings($company->settings, $client->settings)]);
|
||||
RecurringInvoice::factory()->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]);
|
||||
|
||||
/*Credits*/
|
||||
factory(\App\Models\Quote::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]);
|
||||
Quote::factory()->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]);
|
||||
|
||||
$quotes = Quote::cursor();
|
||||
$quote_repo = new QuoteRepository();
|
@ -1,4 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
namespace Database\Seeders;
|
||||
|
||||
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\DataMapper\DefaultSettings;
|
||||
@ -7,6 +18,7 @@ use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\User;
|
||||
use App\Models\UserAccount;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class UsersTableSeeder extends Seeder
|
||||
@ -22,12 +34,12 @@ class UsersTableSeeder extends Seeder
|
||||
{
|
||||
$this->command->info('Running UsersTableSeeder');
|
||||
|
||||
Eloquent::unguard();
|
||||
Model::unguard();
|
||||
|
||||
$faker = \Faker\Factory::create();
|
||||
|
||||
$account = factory(\App\Models\Account::class)->create();
|
||||
$company = factory(\App\Models\Company::class)->create([
|
||||
$account = Account::factory()->create();
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'domain' => 'ninja.test',
|
||||
]);
|
||||
@ -35,7 +47,7 @@ class UsersTableSeeder extends Seeder
|
||||
$account->default_company_id = $company->id;
|
||||
$account->save();
|
||||
|
||||
$user = factory(\App\Models\User::class)->create([
|
||||
$user = User::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
||||
]);
|
||||
@ -59,7 +71,7 @@ class UsersTableSeeder extends Seeder
|
||||
'is_locked' => 0,
|
||||
]);
|
||||
|
||||
$client = factory(\App\Models\Client::class)->create([
|
||||
$client = Client::factory()->create([
|
||||
'user_id' => $user->id,
|
||||
'company_id' => $company->id,
|
||||
]);
|
||||
@ -74,15 +86,15 @@ class UsersTableSeeder extends Seeder
|
||||
'client_id' =>$client->id,
|
||||
]);
|
||||
|
||||
factory(\App\Models\Client::class, 20)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) {
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
Client::factory()->count(20)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) {
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $company->id,
|
||||
'is_primary' => 1,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 10)->create([
|
||||
ClientContact::factory()->count(10)->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $company->id,
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Timezone;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->command->info('Running DatabaseSeeder');
|
||||
|
||||
if (Timezone::count()) {
|
||||
$this->command->info('Skipping: already run');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Eloquent::unguard();
|
||||
|
||||
$this->call('ConstantsSeeder');
|
||||
$this->call('PaymentLibrariesSeeder');
|
||||
$this->call('BanksSeeder');
|
||||
$this->call('CurrenciesSeeder');
|
||||
$this->call('LanguageSeeder');
|
||||
$this->call('CountriesSeeder');
|
||||
$this->call('IndustrySeeder');
|
||||
//$this->call('PaymentTermsSeeder');
|
||||
$this->call('PaymentTypesSeeder');
|
||||
$this->call('GatewayTypesSeeder');
|
||||
$this->call('DateFormatsSeeder');
|
||||
$this->call('DesignSeeder');
|
||||
}
|
||||
}
|
123
phpunit.xml
123
phpunit.xml
@ -1,69 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="true"
|
||||
stopOnFailure="true">
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory suffix="Test.php">./tests/Unit</directory>
|
||||
</testsuite>
|
||||
|
||||
<testsuite name="Integration">
|
||||
<directory suffix="Test.php">./tests/Integration</directory>
|
||||
</testsuite>
|
||||
|
||||
<testsuite name="Feature">
|
||||
<directory suffix="Test.php">./tests/Feature</directory>
|
||||
</testsuite>
|
||||
|
||||
<testsuite name="Pdf">
|
||||
<directory suffix="Test.php">./tests/Pdf</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">./app</directory>
|
||||
<exclude>
|
||||
<directory suffix=".php">./vendor</directory>
|
||||
<directory suffix=".php">./app/Providers</directory>
|
||||
<directory suffix=".php">./app/Http</directory>
|
||||
<directory suffix=".php">./app/Models</directory>
|
||||
<directory suffix=".php">./app/Transformers</directory>
|
||||
<directory suffix=".php">./app/Events</directory>
|
||||
<directory suffix=".php">./app/Observers</directory>
|
||||
<directory suffix=".php">./app/Policies</directory>
|
||||
<directory suffix=".php">./app/Jobs</directory>
|
||||
<directory suffix=".php">./app/Factory</directory>
|
||||
<directory suffix=".php">./app/Helpers</directory>
|
||||
<directory suffix=".php">./app/Libraries</directory>
|
||||
<directory suffix=".php">./app/Listeners</directory>
|
||||
<directory suffix=".php">./app/Mail</directory>
|
||||
<directory suffix=".php">./app/Notifications</directory>
|
||||
<directory suffix=".php">./app/Providers</directory>
|
||||
<directory suffix=".php">./app/Repositories</directory>
|
||||
<directory suffix=".php">./app/Filters</directory>
|
||||
<file>./app/Console/Kernel.php</file>
|
||||
<file>./app/Constants.php</file>
|
||||
<file>./app/Libraries/OFX.php</file>
|
||||
<file>./app/Exceptions/Handler.php</file>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
|
||||
</filter>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="MAIL_MAILER" value="array"/>
|
||||
</php>
|
||||
<logging>
|
||||
<log type="coverage-clover" target="coverage.xml"/>
|
||||
</logging>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="true" stopOnFailure="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
||||
<coverage processUncoveredFiles="true">
|
||||
<include>
|
||||
<directory suffix=".php">./app</directory>
|
||||
</include>
|
||||
<exclude>
|
||||
<directory suffix=".php">./vendor</directory>
|
||||
<directory suffix=".php">./app/Providers</directory>
|
||||
<directory suffix=".php">./app/Http</directory>
|
||||
<directory suffix=".php">./app/Models</directory>
|
||||
<directory suffix=".php">./app/Transformers</directory>
|
||||
<directory suffix=".php">./app/Events</directory>
|
||||
<directory suffix=".php">./app/Observers</directory>
|
||||
<directory suffix=".php">./app/Policies</directory>
|
||||
<directory suffix=".php">./app/Jobs</directory>
|
||||
<directory suffix=".php">./app/Factory</directory>
|
||||
<directory suffix=".php">./app/Helpers</directory>
|
||||
<directory suffix=".php">./app/Libraries</directory>
|
||||
<directory suffix=".php">./app/Listeners</directory>
|
||||
<directory suffix=".php">./app/Mail</directory>
|
||||
<directory suffix=".php">./app/Notifications</directory>
|
||||
<directory suffix=".php">./app/Providers</directory>
|
||||
<directory suffix=".php">./app/Repositories</directory>
|
||||
<directory suffix=".php">./app/Filters</directory>
|
||||
<file>./app/Console/Kernel.php</file>
|
||||
<file>./app/Constants.php</file>
|
||||
<file>./app/Libraries/OFX.php</file>
|
||||
<file>./app/Exceptions/Handler.php</file>
|
||||
</exclude>
|
||||
<report>
|
||||
<clover outputFile="coverage.xml"/>
|
||||
</report>
|
||||
</coverage>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory suffix="Test.php">./tests/Unit</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Integration">
|
||||
<directory suffix="Test.php">./tests/Integration</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Feature">
|
||||
<directory suffix="Test.php">./tests/Feature</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Pdf">
|
||||
<directory suffix="Test.php">./tests/Pdf</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="MAIL_MAILER" value="array"/>
|
||||
</php>
|
||||
<logging/>
|
||||
</phpunit>
|
||||
|
@ -134,15 +134,15 @@ class ClientTest extends TestCase
|
||||
*/
|
||||
public function testClientRestEndPoints()
|
||||
{
|
||||
factory(\App\Models\Client::class, 3)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) {
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
Client::factory()->count(3)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) {
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $this->company->id,
|
||||
'is_primary' => 1,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 2)->create([
|
||||
ClientContact::factory()->count(2)->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -204,15 +204,15 @@ class ClientTest extends TestCase
|
||||
|
||||
public function testDefaultTimeZoneFromClientModel()
|
||||
{
|
||||
$account = factory(\App\Models\Account::class)->create();
|
||||
$company = factory(\App\Models\Company::class)->create([
|
||||
$account = Account::factory()->create();
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
]);
|
||||
|
||||
$account->default_company_id = $company->id;
|
||||
$account->save();
|
||||
|
||||
$user = factory(\App\Models\User::class)->create([
|
||||
$user = User::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
||||
'email' => 'whiz@gmail.com',
|
||||
@ -239,15 +239,15 @@ class ClientTest extends TestCase
|
||||
'is_locked' => 0,
|
||||
]);
|
||||
|
||||
factory(\App\Models\Client::class, 3)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) {
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
Client::factory()->count(3)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) {
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $company->id,
|
||||
'is_primary' => 1,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 2)->create([
|
||||
ClientContact::factory()->count(2)->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $company->id,
|
||||
@ -270,15 +270,15 @@ class ClientTest extends TestCase
|
||||
|
||||
public function testCreatingClientAndContacts()
|
||||
{
|
||||
$account = factory(\App\Models\Account::class)->create();
|
||||
$company = factory(\App\Models\Company::class)->create([
|
||||
'account_id' => $account->id,
|
||||
]);
|
||||
$account = Account::factory()->create();
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
]);
|
||||
|
||||
$account->default_company_id = $company->id;
|
||||
$account->save();
|
||||
|
||||
$user = factory(\App\Models\User::class)->create([
|
||||
$user = User::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
||||
'email' => 'whiz@gmail.com',
|
||||
|
@ -12,6 +12,7 @@ namespace Tests\Feature;
|
||||
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Credit;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@ -41,15 +42,15 @@ class CreditTest extends TestCase
|
||||
|
||||
public function testCreditsList()
|
||||
{
|
||||
factory(Client::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) {
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
Client::factory()->count(3)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) {
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $this->company->id,
|
||||
'is_primary' => 1,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -58,7 +59,7 @@ class CreditTest extends TestCase
|
||||
|
||||
$client = Client::all()->first();
|
||||
|
||||
factory(Credit::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
|
||||
Credit::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
|
@ -18,6 +18,8 @@ use App\Factory\InvoiceInvitationFactory;
|
||||
use App\Jobs\Account\CreateAccount;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Company;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\Models\User;
|
||||
@ -56,8 +58,8 @@ class InvitationTest extends TestCase
|
||||
|
||||
public function testInvoiceCreationAfterInvoiceMarkedSent()
|
||||
{
|
||||
$account = factory(\App\Models\Account::class)->create();
|
||||
$company = factory(\App\Models\Company::class)->create([
|
||||
$account = Account::factory()->create();
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
]);
|
||||
|
||||
@ -67,7 +69,7 @@ class InvitationTest extends TestCase
|
||||
$user = User::where('email', 'user@example.com')->first();
|
||||
|
||||
if (! $user) {
|
||||
$user = factory(\App\Models\User::class)->create([
|
||||
$user = User::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
||||
]);
|
||||
@ -94,15 +96,15 @@ class InvitationTest extends TestCase
|
||||
'is_locked' => 0,
|
||||
]);
|
||||
|
||||
factory(\App\Models\Client::class)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) {
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
Client::factory()->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) {
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $company->id,
|
||||
'is_primary' => 1,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 2)->create([
|
||||
ClientContact::factory()->count(2)->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $company->id,
|
||||
@ -111,7 +113,7 @@ class InvitationTest extends TestCase
|
||||
|
||||
$client = Client::whereUserId($user->id)->whereCompanyId($company->id)->first();
|
||||
|
||||
factory(\App\Models\Invoice::class, 5)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]);
|
||||
Invoice::factory()->count(5)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]);
|
||||
|
||||
$invoice = Invoice::whereUserId($user->id)->whereCompanyId($company->id)->whereClientId($client->id)->first();
|
||||
|
||||
|
@ -15,6 +15,7 @@ use App\DataMapper\CompanySettings;
|
||||
use App\Factory\InvoiceFactory;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Invoice;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@ -51,15 +52,15 @@ class InvoiceTest extends TestCase
|
||||
|
||||
public function testInvoiceList()
|
||||
{
|
||||
factory(\App\Models\Client::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) {
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
Client::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) {
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $this->company->id,
|
||||
'is_primary' => 1,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -68,7 +69,7 @@ class InvoiceTest extends TestCase
|
||||
|
||||
$client = Client::all()->first();
|
||||
|
||||
factory(\App\Models\Invoice::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
|
||||
Invoice::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
@ -153,7 +154,7 @@ class InvoiceTest extends TestCase
|
||||
public function testUniqueNumberValidation()
|
||||
{
|
||||
/* stub a invoice in the DB that we will use to test against later */
|
||||
$invoice = factory(\App\Models\Invoice::class)->create([
|
||||
$invoice = Invoice::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $this->client->id,
|
||||
'company_id' => $this->company->id,
|
||||
|
@ -13,6 +13,7 @@ namespace Tests\Feature;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyToken;
|
||||
use App\Models\User;
|
||||
use App\Utils\Traits\UserSessionAttributes;
|
||||
@ -58,7 +59,7 @@ class LoginTest extends TestCase
|
||||
// $user = factory(User::class)->create([
|
||||
// // 'account_id' => $account->id,
|
||||
// ]);
|
||||
// $company = factory(\App\Models\Company::class)->make([
|
||||
// $company = Company::factory()->make([
|
||||
// 'account_id' => $account->id,
|
||||
// ]);
|
||||
|
||||
@ -90,7 +91,7 @@ class LoginTest extends TestCase
|
||||
// $user = factory(User::class)->create([
|
||||
// // 'account_id' => $account->id,
|
||||
// ]);
|
||||
// $company = factory(\App\Models\Company::class)->make([
|
||||
// $company = Company::factory()->make([
|
||||
// 'account_id' => $account->id,
|
||||
// ]);
|
||||
|
||||
@ -120,7 +121,7 @@ class LoginTest extends TestCase
|
||||
// $user = factory(User::class)->create([
|
||||
// // 'account_id' => $account->id,
|
||||
// ]);
|
||||
// $company = factory(\App\Models\Company::class)->make([
|
||||
// $company = Company::factory()->make([
|
||||
// 'account_id' => $account->id,
|
||||
// ]);
|
||||
|
||||
@ -140,14 +141,14 @@ class LoginTest extends TestCase
|
||||
|
||||
public function testApiLogin()
|
||||
{
|
||||
$account = factory(Account::class)->create();
|
||||
$user = factory(User::class)->create([
|
||||
$account = Account::factory()->create();
|
||||
$user = User::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'email' => 'test@example.com',
|
||||
'password' => \Hash::make('123456'),
|
||||
]);
|
||||
|
||||
$company = factory(\App\Models\Company::class)->create([
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
]);
|
||||
|
||||
|
@ -20,6 +20,7 @@ use App\Helpers\Invoice\InvoiceSum;
|
||||
use App\Models\Account;
|
||||
use App\Models\Activity;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
@ -67,15 +68,15 @@ class PaymentTest extends TestCase
|
||||
|
||||
public function testPaymentList()
|
||||
{
|
||||
factory(\App\Models\Client::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) {
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
Client::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) {
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $this->company->id,
|
||||
'is_primary' => 1,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -84,7 +85,7 @@ class PaymentTest extends TestCase
|
||||
|
||||
$client = Client::all()->first();
|
||||
|
||||
factory(\App\Models\Payment::class, 1)->create(
|
||||
Payment::factory()->create(
|
||||
['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $client->id]
|
||||
);
|
||||
|
||||
@ -98,7 +99,7 @@ class PaymentTest extends TestCase
|
||||
|
||||
public function testPaymentRESTEndPoints()
|
||||
{
|
||||
factory(\App\Models\Payment::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
|
||||
Payment::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
|
||||
|
||||
$Payment = Payment::all()->last();
|
||||
|
||||
@ -271,7 +272,7 @@ class PaymentTest extends TestCase
|
||||
$client = ClientFactory::create($this->company->id, $this->user->id);
|
||||
$client->save();
|
||||
|
||||
factory(\App\Models\ClientContact::class)->create([
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
'company_id' =>$this->company->id,
|
||||
@ -347,7 +348,7 @@ class PaymentTest extends TestCase
|
||||
$client->setRelation('company', $this->company);
|
||||
$client->save();
|
||||
|
||||
$client_contact = factory(\App\Models\ClientContact::class, 1)->create([
|
||||
$client_contact = ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -423,7 +424,7 @@ class PaymentTest extends TestCase
|
||||
$client = ClientFactory::create($this->company->id, $this->user->id);
|
||||
$client->save();
|
||||
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -431,7 +432,7 @@ class PaymentTest extends TestCase
|
||||
'send_email' => true,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -495,7 +496,7 @@ class PaymentTest extends TestCase
|
||||
$client = ClientFactory::create($this->company->id, $this->user->id);
|
||||
$client->save();
|
||||
|
||||
$contact = factory(\App\Models\ClientContact::class, 1)->create([
|
||||
$contact = ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $this->client->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -503,7 +504,7 @@ class PaymentTest extends TestCase
|
||||
'send_email' => true,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $this->client->id,
|
||||
'company_id' => $this->company->id,
|
||||
|
@ -14,6 +14,7 @@ use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@ -55,15 +56,16 @@ class RecurringInvoiceTest extends TestCase
|
||||
|
||||
public function testRecurringInvoiceList()
|
||||
{
|
||||
factory(\App\Models\Client::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) {
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
Client::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) {
|
||||
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $this->company->id,
|
||||
'is_primary' => 1,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -72,7 +74,7 @@ class RecurringInvoiceTest extends TestCase
|
||||
|
||||
$client = Client::all()->first();
|
||||
|
||||
factory(\App\Models\RecurringInvoice::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
|
||||
RecurringInvoice::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
@ -84,15 +86,16 @@ class RecurringInvoiceTest extends TestCase
|
||||
|
||||
public function testRecurringInvoiceRESTEndPoints()
|
||||
{
|
||||
factory(\App\Models\Client::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) {
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
Client::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) {
|
||||
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $this->company->id,
|
||||
'is_primary' => 1,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $c->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -100,7 +103,7 @@ class RecurringInvoiceTest extends TestCase
|
||||
});
|
||||
$client = Client::all()->first();
|
||||
|
||||
factory(\App\Models\RecurringInvoice::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
|
||||
RecurringInvoice::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
|
||||
|
||||
$RecurringInvoice = RecurringInvoice::where('user_id', $this->user->id)->first();
|
||||
$RecurringInvoice->save();
|
||||
|
@ -55,7 +55,7 @@ class RecurringQuoteTest extends TestCase
|
||||
|
||||
public function testRecurringQuoteList()
|
||||
{
|
||||
factory(\App\Models\RecurringQuote::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
|
||||
RecurringQuote::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
@ -67,7 +67,7 @@ class RecurringQuoteTest extends TestCase
|
||||
|
||||
public function testRecurringQuoteRESTEndPoints()
|
||||
{
|
||||
factory(\App\Models\RecurringQuote::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
|
||||
RecurringQuote::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
|
||||
|
||||
$RecurringQuote = RecurringQuote::where('user_id', $this->user->id)->first();
|
||||
$RecurringQuote->save();
|
||||
|
@ -12,6 +12,7 @@ namespace Tests\Feature\Shop;
|
||||
|
||||
use App\Factory\CompanyUserFactory;
|
||||
use App\Models\CompanyToken;
|
||||
use App\Models\Product;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Routing\Middleware\ThrottleRequests;
|
||||
@ -98,7 +99,7 @@ class ShopInvoiceTest extends TestCase
|
||||
$this->company->enable_shop_api = true;
|
||||
$this->company->save();
|
||||
|
||||
$product = factory(\App\Models\Product::class)->create([
|
||||
$product = Product::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
]);
|
||||
|
@ -138,7 +138,7 @@ class UserTest extends TestCase
|
||||
$this->withoutMiddleware(PasswordProtection::class);
|
||||
|
||||
/* Create New Company */
|
||||
$company2 = factory(\App\Models\Company::class)->create([
|
||||
$company2 = Company::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
]);
|
||||
|
||||
|
@ -19,6 +19,8 @@ use App\Factory\InvoiceItemFactory;
|
||||
use App\Jobs\Invoice\MarkInvoicePaid;
|
||||
use App\Models\Account;
|
||||
use App\Models\Activity;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyLedger;
|
||||
use App\Models\CompanyToken;
|
||||
@ -79,8 +81,8 @@ class CompanyLedgerTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
$this->account = factory(\App\Models\Account::class)->create();
|
||||
$this->company = factory(\App\Models\Company::class)->create([
|
||||
$this->account = Account::factory()->create();
|
||||
$this->company = Company::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
]);
|
||||
|
||||
@ -108,7 +110,7 @@ class CompanyLedgerTest extends TestCase
|
||||
$this->user = User::whereEmail('user@example.com')->first();
|
||||
|
||||
if (! $this->user) {
|
||||
$this->user = factory(\App\Models\User::class)->create([
|
||||
$this->user = User::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
'password' => Hash::make('ALongAndBriliantPassword'),
|
||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
||||
@ -130,12 +132,12 @@ class CompanyLedgerTest extends TestCase
|
||||
$company_token->token = $this->token;
|
||||
$company_token->save();
|
||||
|
||||
$this->client = factory(\App\Models\Client::class)->create([
|
||||
$this->client = Client::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $this->client->id,
|
||||
'company_id' => $this->company->id,
|
||||
|
@ -40,18 +40,18 @@ class MultiDBUserTest extends TestCase
|
||||
|
||||
User::unguard();
|
||||
|
||||
$ac = factory(\App\Models\Account::class)->make();
|
||||
$ac = Account::factory()->make();
|
||||
|
||||
$ac->setHidden(['hashed_id']);
|
||||
|
||||
$account = Account::on('db-ninja-01')->create($ac->toArray());
|
||||
$account2 = Account::on('db-ninja-02')->create($ac->toArray());
|
||||
|
||||
$company = factory(\App\Models\Company::class)->make([
|
||||
$company = Company::factory()->make([
|
||||
'account_id' => $account->id,
|
||||
]);
|
||||
|
||||
$company2 = factory(\App\Models\Company::class)->make([
|
||||
$company2 = Company::factory()->make([
|
||||
'account_id' => $account2->id,
|
||||
]);
|
||||
|
||||
|
@ -42,12 +42,12 @@ class UniqueEmailTest extends TestCase
|
||||
|
||||
$this->rule = new NewUniqueUserRule();
|
||||
|
||||
$ac = factory(\App\Models\Account::class)->make();
|
||||
$ac = Account::factory()->make();
|
||||
$ac->setHidden(['hashed_id']);
|
||||
|
||||
$account = Account::on('db-ninja-01')->create($ac->toArray());
|
||||
|
||||
$company = factory(\App\Models\Company::class)->make([
|
||||
$company = Company::factory()->make([
|
||||
'account_id' => $account->id,
|
||||
]);
|
||||
|
||||
@ -55,11 +55,11 @@ class UniqueEmailTest extends TestCase
|
||||
|
||||
Company::on('db-ninja-01')->create($company->toArray());
|
||||
|
||||
$ac2 = factory(\App\Models\Account::class)->make();
|
||||
$ac2 = Account::factory()->make();
|
||||
$ac2->setHidden(['hashed_id']);
|
||||
$account2 = Account::on('db-ninja-02')->create($ac2->toArray());
|
||||
|
||||
$company2 = factory(\App\Models\Company::class)->make([
|
||||
$company2 = Company::factory()->make([
|
||||
'account_id' => $account2->id,
|
||||
]);
|
||||
|
||||
|
@ -24,17 +24,23 @@ use App\Factory\InvoiceInvitationFactory;
|
||||
use App\Factory\InvoiceItemFactory;
|
||||
use App\Factory\InvoiceToRecurringInvoiceFactory;
|
||||
use App\Helpers\Invoice\InvoiceSum;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyGateway;
|
||||
use App\Models\CompanyToken;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Expense;
|
||||
use App\Models\GroupSetting;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\Models\Quote;
|
||||
use App\Models\QuoteInvitation;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Models\User;
|
||||
use App\Models\Vendor;
|
||||
use App\Models\VendorContact;
|
||||
use App\Utils\Traits\CompanyGatewayFeesAndLimitsSaver;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
@ -96,10 +102,11 @@ trait MockAccountData
|
||||
}
|
||||
}
|
||||
|
||||
$this->account = factory(\App\Models\Account::class)->create();
|
||||
$this->company = factory(\App\Models\Company::class)->create([
|
||||
'account_id' => $this->account->id,
|
||||
]);
|
||||
|
||||
$this->account = Account::factory()->create();
|
||||
$this->company = Company::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
]);
|
||||
|
||||
$settings = CompanySettings::defaults();
|
||||
|
||||
@ -125,10 +132,11 @@ trait MockAccountData
|
||||
$this->user = User::whereEmail('user@example.com')->first();
|
||||
|
||||
if (! $this->user) {
|
||||
$this->user = factory(\App\Models\User::class)->create([
|
||||
'account_id' => $this->account->id,
|
||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
||||
]);
|
||||
|
||||
$this->user = User::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
||||
]);
|
||||
}
|
||||
|
||||
$this->user->password = Hash::make('ALongAndBriliantPassword');
|
||||
@ -150,12 +158,12 @@ trait MockAccountData
|
||||
|
||||
$company_token->save();
|
||||
|
||||
$this->client = factory(\App\Models\Client::class)->create([
|
||||
$this->client = Client::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
]);
|
||||
|
||||
$contact = factory(\App\Models\ClientContact::class)->create([
|
||||
$contact = ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $this->client->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -163,19 +171,21 @@ trait MockAccountData
|
||||
'send_email' => true,
|
||||
]);
|
||||
|
||||
$contact2 = factory(\App\Models\ClientContact::class)->create([
|
||||
|
||||
$contact2 = ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $this->client->id,
|
||||
'company_id' => $this->company->id,
|
||||
'send_email' => true,
|
||||
]);
|
||||
|
||||
$this->vendor = factory(\App\Models\Vendor::class)->create([
|
||||
$this->vendor = Vendor::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
]);
|
||||
|
||||
$vendor_contact = factory(\App\Models\VendorContact::class)->create([
|
||||
|
||||
$vendor_contact = VendorContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'vendor_id' => $this->vendor->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -183,22 +193,20 @@ trait MockAccountData
|
||||
'send_email' => true,
|
||||
]);
|
||||
|
||||
$vendor_contact2 = factory(\App\Models\VendorContact::class)->create([
|
||||
$vendor_contact2 = VendorContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'vendor_id' => $this->vendor->id,
|
||||
'company_id' => $this->company->id,
|
||||
'send_email' => true,
|
||||
]);
|
||||
|
||||
$this->expense = factory(\App\Models\Expense::class)->create([
|
||||
|
||||
|
||||
$this->expense = Expense::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
]);
|
||||
|
||||
// $rels = collect($contact, $contact2);
|
||||
// $this->client->setRelation('contacts', $rels);
|
||||
// $this->client->save();
|
||||
|
||||
$gs = new GroupSetting;
|
||||
$gs->name = 'Test';
|
||||
$gs->company_id = $this->client->company_id;
|
||||
@ -215,7 +223,7 @@ trait MockAccountData
|
||||
$this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id
|
||||
$this->invoice->client_id = $this->client->id;
|
||||
|
||||
// $this->invoice = factory(\App\Models\Invoice::class)->create([
|
||||
// $this->invoice = Invoice::factory()->create([
|
||||
// 'user_id' => $this->user->id,
|
||||
// 'client_id' => $this->client->id,
|
||||
// 'company_id' => $this->company->id,
|
||||
@ -238,15 +246,14 @@ trait MockAccountData
|
||||
|
||||
//$this->invoice->service()->createInvitations()->markSent();
|
||||
//$this->invoice->service()->createInvitations();
|
||||
|
||||
factory(\App\Models\InvoiceInvitation::class)->create([
|
||||
InvoiceInvitation::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
'client_contact_id' => $contact->id,
|
||||
'invoice_id' => $this->invoice->id,
|
||||
]);
|
||||
|
||||
factory(\App\Models\InvoiceInvitation::class)->create([
|
||||
InvoiceInvitation::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
'client_contact_id' => $contact2->id,
|
||||
@ -255,7 +262,7 @@ trait MockAccountData
|
||||
|
||||
$this->invoice->service()->markSent();
|
||||
|
||||
$this->quote = factory(\App\Models\Quote::class)->create([
|
||||
$this->quote = Quote::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $this->client->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -276,14 +283,14 @@ trait MockAccountData
|
||||
|
||||
//$this->quote->service()->createInvitations()->markSent();
|
||||
|
||||
factory(\App\Models\QuoteInvitation::class)->create([
|
||||
QuoteInvitation::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
'client_contact_id' => $contact->id,
|
||||
'quote_id' => $this->quote->id,
|
||||
]);
|
||||
|
||||
factory(\App\Models\QuoteInvitation::class)->create([
|
||||
QuoteInvitation::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
'client_contact_id' => $contact2->id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user