added source feature

This commit is contained in:
Denis Duliçi
2021-09-07 10:33:34 +03:00
parent 0a4e066451
commit c59c71b0f9
80 changed files with 475 additions and 63 deletions

View File

@ -31,6 +31,7 @@ class Account extends Factory
'bank_phone' => $this->faker->phoneNumber,
'bank_address' => $this->faker->address,
'enabled' => $this->faker->boolean ? 1 : 0,
'created_from' => 'factory',
];
}

View File

@ -29,6 +29,7 @@ class Category extends Factory
'type' => $this->faker->randomElement($types),
'color' => $this->faker->hexColor,
'enabled' => $this->faker->boolean ? 1 : 0,
'created_from' => 'factory',
];
}

View File

@ -39,6 +39,7 @@ class Contact extends Factory
'currency_code' => setting('default.currency'),
'reference' => $this->faker->text(5),
'enabled' => $this->faker->boolean ? 1 : 0,
'created_from' => 'factory',
];
}

View File

@ -47,6 +47,7 @@ class Currency extends Factory
'decimal_mark' => $currency['decimal_mark'],
'thousands_separator' => $currency['thousands_separator'],
'enabled' => $this->faker->boolean ? 1 : 0,
'created_from' => 'factory',
];
}

View File

@ -25,6 +25,7 @@ class Dashboard extends Factory
'company_id' => $this->company->id,
'name' => $this->faker->text(15),
'enabled' => $this->faker->boolean ? 1 : 0,
'created_from' => 'factory',
];
}

View File

@ -45,6 +45,7 @@ class Document extends AbstractFactory
'currency_rate' => '1',
'notes' => $this->faker->text(5),
'amount' => '0',
'created_from' => 'factory',
];
}

View File

@ -29,6 +29,7 @@ class Item extends Factory
'sale_price' => $this->faker->randomFloat(2, 10, 20),
'category_id' => $this->company->categories()->item()->get()->random(1)->pluck('id')->first(),
'enabled' => $this->faker->boolean ? 1 : 0,
'created_from' => 'factory',
];
}

View File

@ -34,6 +34,7 @@ class Reconciliation extends Factory
'started_at' => $started_at,
'ended_at' => $ended_at,
'reconcile' => $this->faker->boolean ? 1 : 0,
'created_from' => 'factory',
];
}

View File

@ -28,6 +28,7 @@ class Role extends Factory
'name' => strtolower($name),
'display_name' => $name,
'description' => $name,
'created_from' => 'factory',
];
}

View File

@ -29,6 +29,7 @@ class Tax extends Factory
'rate' => $this->faker->randomFloat(2, 10, 20),
'type' => $this->faker->randomElement($types),
'enabled' => $this->faker->boolean ? 1 : 0,
'created_from' => 'factory',
];
}

View File

@ -41,6 +41,7 @@ class Transaction extends Factory
'category_id' => $this->company->categories()->$category_type()->get()->random(1)->pluck('id')->first(),
'reference' => $this->faker->text(5),
'payment_method' => setting('default.payment_method'),
'created_from' => 'factory',
];
}

View File

@ -43,6 +43,7 @@ class Transfer extends Factory
'category_id' => Category::transfer(),
'description' => $this->faker->text(20),
'reference' => $this->faker->text(20),
'created_from' => 'factory',
];
$expense_transaction = Transaction::factory()->create(array_merge($request, [

View File

@ -34,6 +34,7 @@ class User extends Factory
'companies' => ['1'],
'roles' => ['1'],
'enabled' => $this->faker->boolean ? 1 : 0,
'created_from' => 'factory',
];
}

View File

@ -42,6 +42,7 @@ class Widget extends Factory
'dashboard_id' => $dashboard->id,
'name' => $this->faker->text(15),
'class' => $this->faker->randomElement($this->classes),
'created_from' => 'factory',
];
}
}

View File

@ -19,6 +19,127 @@ class CoreV2124 extends Migration
$table->string('zip_code')->nullable()->after('address');
$table->string('city')->nullable()->after('address');
});
Schema::table('accounts', function (Blueprint $table) {
$table->string('created_from', 30)->nullable()->after('enabled');
});
Schema::table('categories', function (Blueprint $table) {
$table->string('created_from', 30)->nullable()->after('enabled');
});
Schema::table('companies', function (Blueprint $table) {
$table->string('created_from', 30)->nullable()->after('enabled');
});
Schema::table('contacts', function (Blueprint $table) {
$table->string('created_from', 30)->nullable()->after('reference');
});
Schema::table('currencies', function (Blueprint $table) {
$table->string('created_from', 30)->nullable()->after('enabled');
});
Schema::table('dashboards', function (Blueprint $table) {
$table->string('created_from', 30)->nullable()->after('enabled');
});
Schema::table('documents', function (Blueprint $table) {
$table->string('created_from', 30)->nullable()->after('parent_id');
});
Schema::table('document_histories', function (Blueprint $table) {
$table->string('created_by', 30)->nullable()->after('description');
$table->string('created_from', 30)->nullable()->after('description');
});
Schema::table('document_items', function (Blueprint $table) {
$table->string('created_by', 30)->nullable()->after('total');
$table->string('created_from', 30)->nullable()->after('total');
});
Schema::table('document_item_taxes', function (Blueprint $table) {
$table->string('created_by', 30)->nullable()->after('amount');
$table->string('created_from', 30)->nullable()->after('amount');
});
Schema::table('document_totals', function (Blueprint $table) {
$table->string('created_by', 30)->nullable()->after('sort_order');
$table->string('created_from', 30)->nullable()->after('sort_order');
});
Schema::table('email_templates', function (Blueprint $table) {
$table->string('created_by', 30)->nullable()->after('params');
$table->string('created_from', 30)->nullable()->after('params');
});
Schema::table('items', function (Blueprint $table) {
$table->string('created_from', 30)->nullable()->after('enabled');
});
Schema::table('item_taxes', function (Blueprint $table) {
$table->string('created_by', 30)->nullable()->after('tax_id');
$table->string('created_from', 30)->nullable()->after('tax_id');
});
Schema::table('media', function (Blueprint $table) {
$table->string('created_by', 30)->nullable()->after('original_media_id');
$table->string('created_from', 30)->nullable()->after('original_media_id');
});
Schema::table('mediables', function (Blueprint $table) {
$table->string('created_by', 30)->nullable()->after('order');
$table->string('created_from', 30)->nullable()->after('order');
});
Schema::table('modules', function (Blueprint $table) {
$table->string('created_by', 30)->nullable()->after('enabled');
$table->string('created_from', 30)->nullable()->after('enabled');
});
Schema::table('module_histories', function (Blueprint $table) {
$table->string('created_by', 30)->nullable()->after('description');
$table->string('created_from', 30)->nullable()->after('description');
});
Schema::table('reconciliations', function (Blueprint $table) {
$table->string('created_from', 30)->nullable()->after('reconciled');
});
Schema::table('recurring', function (Blueprint $table) {
$table->string('created_by', 30)->nullable()->after('count');
$table->string('created_from', 30)->nullable()->after('count');
});
Schema::table('reports', function (Blueprint $table) {
$table->string('created_from', 30)->nullable()->after('settings');
});
Schema::table('roles', function (Blueprint $table) {
$table->string('created_by', 30)->nullable()->after('description');
$table->string('created_from', 30)->nullable()->after('description');
});
Schema::table('taxes', function (Blueprint $table) {
$table->string('created_from', 30)->nullable()->after('enabled');
});
Schema::table('transactions', function (Blueprint $table) {
$table->string('created_from', 30)->nullable()->after('parent_id');
});
Schema::table('transfers', function (Blueprint $table) {
$table->string('created_from', 30)->nullable()->after('income_transaction_id');
});
Schema::table('users', function (Blueprint $table) {
$table->string('created_by', 30)->nullable()->after('enabled');
$table->string('created_from', 30)->nullable()->after('enabled');
});
Schema::table('widgets', function (Blueprint $table) {
$table->string('created_from', 30)->nullable()->after('settings');
});
}
/**
@ -28,8 +149,6 @@ class CoreV2124 extends Migration
*/
public function down()
{
Schema::table('contacts', function (Blueprint $table) {
$table->dropColumn(['country','state', 'zip_code', 'city',]);
});
//
}
}

View File

@ -36,6 +36,7 @@ class Accounts extends Seeder
'currency_code' => 'USD',
'bank_name' => trans('demo.accounts.cash'),
'enabled' => '1',
'created_from' => 'seed',
]));
setting()->set('default.account', $account->id);

View File

@ -70,6 +70,8 @@ class Categories extends Seeder
$income_category_id = $expense_category_id = 0;
foreach ($rows as $row) {
$row['created_from'] = 'seed';
$category = $this->dispatch(new CreateCategory($row));
switch ($category->type) {

View File

@ -78,6 +78,8 @@ class Currencies extends Seeder
];
foreach ($rows as $row) {
$row['created_from'] = 'seed';
$this->dispatch(new CreateCurrency($row));
}
}

View File

@ -45,6 +45,7 @@ class Dashboards extends Seeder
'App\Widgets\LatestExpenses',
],
'users' => $user_id,
'created_from' => 'seed',
]));
}
}

View File

@ -3,11 +3,14 @@
namespace Database\Seeds;
use App\Abstracts\Model;
use App\Models\Common\EmailTemplate;
use App\Jobs\Common\CreateEmailTemplate;
use App\Traits\Jobs;
use Illuminate\Database\Seeder;
class EmailTemplates extends Seeder
{
use Jobs;
/**
* Run the database seeds.
*
@ -80,14 +83,15 @@ class EmailTemplates extends Seeder
];
foreach ($templates as $template) {
EmailTemplate::create([
$this->dispatch(new CreateEmailTemplate([
'company_id' => $company_id,
'alias' => $template['alias'],
'class' => $template['class'],
'name' => $template['name'],
'subject' => trans('email_templates.' . $template['alias'] . '.subject'),
'body' => trans('email_templates.' . $template['alias'] . '.body'),
]);
'created_from' => 'seed',
]));
}
}
}

View File

@ -68,6 +68,8 @@ class Reports extends Seeder
];
foreach ($rows as $row) {
$row['created_from'] = 'seed';
$this->dispatch(new CreateReport($row));
}
}