v5.0.0 update

This commit is contained in:
Mohit Panjwani
2021-11-30 18:58:19 +05:30
parent d332712c22
commit 082d5cacf2
1253 changed files with 88309 additions and 71741 deletions

View File

@@ -567,8 +567,17 @@ class CurrenciesTableSeeder extends Seeder
'thousand_separator' => ',',
'decimal_separator' => '.',
],
[
'name' => 'Jamaican Dollar',
'code' => 'JMD',
'symbol' => '$',
'precision' => '0',
'thousand_separator' => ',',
'decimal_separator' => '.',
],
];
foreach ($currencies as $currency) {
Currency::create($currency);
}

View File

@@ -13,11 +13,8 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
$this->call(UsersTableSeeder::class);
$this->call(CurrenciesTableSeeder::class);
$this->call(DefaultSettingsSeeder::class);
$this->call(CountriesTableSeeder::class);
$this->call(PaymentMethodSeeder::class);
$this->call(UnitSeeder::class);
$this->call(UsersTableSeeder::class);
}
}

View File

@@ -1,72 +0,0 @@
<?php
namespace Database\Seeders;
use Crater\Models\CompanySetting;
use Crater\Models\User;
use Illuminate\Database\Seeder;
class DefaultSettingsSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$user = User::where('role', 'super admin')->first();
$defaultInvoiceEmailBody = 'You have received a new invoice from <b>{COMPANY_NAME}</b>.</br> Please download using the button below:';
$defaultEstimateEmailBody = 'You have received a new estimate from <b>{COMPANY_NAME}</b>.</br> Please download using the button below:';
$defaultPaymentEmailBody = 'Thank you for the payment.</b></br> Please download your payment receipt using the button below:';
$billingAddressFormat = '<h3>{BILLING_ADDRESS_NAME}</h3><p>{BILLING_ADDRESS_STREET_1}</p><p>{BILLING_ADDRESS_STREET_2}</p><p>{BILLING_CITY} {BILLING_STATE}</p><p>{BILLING_COUNTRY} {BILLING_ZIP_CODE}</p><p>{BILLING_PHONE}</p>';
$shippingAddressFormat = '<h3>{SHIPPING_ADDRESS_NAME}</h3><p>{SHIPPING_ADDRESS_STREET_1}</p><p>{SHIPPING_ADDRESS_STREET_2}</p><p>{SHIPPING_CITY} {SHIPPING_STATE}</p><p>{SHIPPING_COUNTRY} {SHIPPING_ZIP_CODE}</p><p>{SHIPPING_PHONE}</p>';
$companyAddressFormat = '<h3><strong>{COMPANY_NAME}</strong></h3><p>{COMPANY_ADDRESS_STREET_1}</p><p>{COMPANY_ADDRESS_STREET_2}</p><p>{COMPANY_CITY} {COMPANY_STATE}</p><p>{COMPANY_COUNTRY} {COMPANY_ZIP_CODE}</p><p>{COMPANY_PHONE}</p>';
$paymentFromCustomerAddress = '<h3>{BILLING_ADDRESS_NAME}</h3><p>{BILLING_ADDRESS_STREET_1}</p><p>{BILLING_ADDRESS_STREET_2}</p><p>{BILLING_CITY} {BILLING_STATE} {BILLING_ZIP_CODE}</p><p>{BILLING_COUNTRY}</p><p>{BILLING_PHONE}</p>';
$settings = [
'invoice_auto_generate' => 'YES',
'payment_auto_generate' => 'YES',
'estimate_auto_generate' => 'YES',
'save_pdf_to_disk' => 'NO',
'invoice_mail_body' => $defaultInvoiceEmailBody,
'estimate_mail_body' => $defaultEstimateEmailBody,
'payment_mail_body' => $defaultPaymentEmailBody,
'invoice_company_address_format' => $companyAddressFormat,
'invoice_shipping_address_format' => $shippingAddressFormat,
'invoice_billing_address_format' => $billingAddressFormat,
'estimate_company_address_format' => $companyAddressFormat,
'estimate_shipping_address_format' => $shippingAddressFormat,
'estimate_billing_address_format' => $billingAddressFormat,
'payment_company_address_format' => $companyAddressFormat,
'payment_from_customer_address_format' => $paymentFromCustomerAddress,
'currency' => 1,
'time_zone' => 'Asia/Kolkata',
'language' => 'en',
'fiscal_year' => '1-12',
'carbon_date_format' => 'Y/m/d',
'moment_date_format' => 'YYYY/MM/DD',
'notification_email' => 'noreply@crater.in',
'notify_invoice_viewed' => 'NO',
'notify_estimate_viewed' => 'NO',
'tax_per_item' => 'NO',
'discount_per_item' => 'NO',
'invoice_prefix' => 'INV',
'invoice_auto_generate' => 'YES',
'invoice_number_length' => 6,
'invoice_email_attachment' => 'NO',
'estimate_prefix' => 'EST',
'estimate_auto_generate' => 'YES',
'estimate_number_length' => 6,
'estimate_email_attachment' => 'NO',
'payment_prefix' => 'PAY',
'payment_auto_generate' => 'YES',
'payment_number_length' => 6,
'payment_email_attachment' => 'NO',
'save_pdf_to_disk' => 'NO',
];
CompanySetting::setSettings($settings, $user->company_id);
}
}

View File

@@ -20,7 +20,7 @@ class DemoSeeder extends Seeder
$user->setSettings(['language' => 'en']);
Address::create(['company_id' => $user->company_id, 'country_id' => 1]);
Address::create(['company_id' => $user->companies()->first()->id, 'country_id' => 1]);
Setting::setSetting('profile_complete', 'COMPLETED');

View File

@@ -1,22 +0,0 @@
<?php
namespace Database\Seeders;
use Crater\Models\PaymentMethod;
use Illuminate\Database\Seeder;
class PaymentMethodSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
PaymentMethod::create(['name' => 'Cash', 'company_id' => 1]);
PaymentMethod::create(['name' => 'Check', 'company_id' => 1]);
PaymentMethod::create(['name' => 'Credit Card', 'company_id' => 1]);
PaymentMethod::create(['name' => 'Bank Transfer', 'company_id' => 1]);
}
}

View File

@@ -1,29 +0,0 @@
<?php
namespace Database\Seeders;
use Crater\Models\Unit;
use Illuminate\Database\Seeder;
class UnitSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Unit::create(['name' => 'box', 'company_id' => 1]);
Unit::create(['name' => 'cm', 'company_id' => 1]);
Unit::create(['name' => 'dz', 'company_id' => 1]);
Unit::create(['name' => 'ft', 'company_id' => 1]);
Unit::create(['name' => 'g', 'company_id' => 1]);
Unit::create(['name' => 'in', 'company_id' => 1]);
Unit::create(['name' => 'kg', 'company_id' => 1]);
Unit::create(['name' => 'km', 'company_id' => 1]);
Unit::create(['name' => 'lb', 'company_id' => 1]);
Unit::create(['name' => 'mg', 'company_id' => 1]);
Unit::create(['name' => 'pc', 'company_id' => 1]);
}
}

View File

@@ -6,6 +6,8 @@ use Crater\Models\Company;
use Crater\Models\Setting;
use Crater\Models\User;
use Illuminate\Database\Seeder;
use Silber\Bouncer\BouncerFacade;
use Vinkla\Hashids\Facades\Hashids;
class UsersTableSeeder extends Seeder
{
@@ -25,11 +27,16 @@ class UsersTableSeeder extends Seeder
$company = Company::create([
'name' => 'xyz',
'unique_hash' => str_random(20),
'owner_id' => $user->id
]);
$user->company_id = $company->id;
$user->save();
$company->unique_hash = Hashids::connection(Company::class)->encode($company->id);
$company->save();
$company->setupDefaultData();
$user->companies()->attach($company->id);
BouncerFacade::scope()->to($company->id);
$user->assign('super admin');
Setting::setSetting('profile_complete', 0);
}