Fixes for CI/CD

This commit is contained in:
Deon George 2022-02-01 20:15:11 +11:00
parent b9b4416737
commit d1a7e399dc
9 changed files with 27 additions and 32 deletions

View File

@ -316,7 +316,7 @@ class Product extends Model implements IDs
static $default = NULL;
if (! $go) {
if (is_null($default))
$default = Group::findOrFail(0); // All public users
$default = Group::whereNull('parent_id')->firstOrFail(); // All public users
$go = $default;
}

View File

@ -24,8 +24,6 @@ class AccountFactory extends Factory
{
// Create Dependencies - should be loaded by seeding.
$co = Country::findOrFail(61);
$lo = Language::findOrFail(1);
$cyo = Currency::findOrFail(6);
return [
'id' => $this->faker->numberBetween(2048,65535),
@ -33,10 +31,8 @@ class AccountFactory extends Factory
// 'date_last',
//* 'site_id', // Needs to be passed in
// 'date_expire',
'language_id' => $lo->id,
'country_id' => $co->id,
// 'rtm_id',
'currency_id' => $cyo->id,
'active' => TRUE,
// 'company',
// 'address1',

View File

@ -36,11 +36,12 @@ class ProductFactory extends Factory
// 'group_avail'
// 'avail_category'
// 'price_type'
'price_group'=>serialize([
1=>[
0=>[
'price_setup'=>50,
'price_base'=>100,
'pricing'=>json_encode([
[
'show'=>true,
[
'setup'=>50,
'base'=>100,
]
]
]),

View File

@ -65,7 +65,7 @@ class ServiceFactory extends Factory
// 'orderedby_id',
// 'order_status',
// 'order_info',
'model' => 'App\Models\Service\Adsl',
'model' => 'App\Models\Service\Broadband',
];
}
}

View File

@ -13,6 +13,8 @@ class OptimizeProduct extends Migration
*/
public function up()
{
$site = \App\Models\Site::where('site_id',1)->firstOrNew();
Schema::table('ab_product', function (Blueprint $table) {
$table->dropForeign(['site_id']);
$table->dropIndex(['id','site_id']);
@ -490,6 +492,10 @@ class OptimizeProduct extends Migration
}
}
// No need to update tables, if we dont have a site setup yet.
if (! $site->exists)
return;
// SSL
$so = \App\Models\Supplier::where('name','Graytech Hosting Pty Ltd')->firstOrNew();
$so->name = 'Graytech Hosting Pty Ltd';
@ -500,7 +506,7 @@ class OptimizeProduct extends Migration
->where('site_id','1')
->where('supplier_id',$so->id)
->firstOrNew();
$sdo->site_id = 1;
$sdo->site_id = $site->site_id;
$so->detail()->save($sdo);
$o = new \App\Models\Supplier\SSL;
@ -538,7 +544,7 @@ class OptimizeProduct extends Migration
->where('site_id','1')
->where('supplier_id',$so->id)
->firstOrNew();
$sdo->site_id = 1;
$sdo->site_id = $site->site_id;
$so->detail()->save($sdo);
$o = new \App\Models\Supplier\Host;
@ -561,7 +567,7 @@ class OptimizeProduct extends Migration
->where('site_id','1')
->where('supplier_id',$so->id)
->firstOrNew();
$sdo->site_id = 1;
$sdo->site_id = $site->site_id;
$so->detail()->save($sdo);
$o = new \App\Models\Supplier\Voip;

View File

@ -22,7 +22,7 @@ class CountryTableSeeder extends Seeder
$o->three_code = 'AUS';
$o->active = TRUE;
$oo = Currency::where('iso_code','AUD')->firstOrFail();
$oo = Currency::where('iso','AUD')->firstOrFail();
$oo->country()->save($o);
}

View File

@ -18,10 +18,10 @@ class CurrencyTableSeeder extends Seeder
$o = new Currency;
$o->id = 6;
$o->name = 'Australian Dollars';
$o->symbol = '$';
$o->iso_code = 'AUD';
$o->rounding = 2;
$o->active = TRUE;
$o->symbol = '$';
$o->iso = 'AUD';
$o->rounding = 2;
$o->save();
}
}

View File

@ -18,7 +18,6 @@ class SiteTableSeeder extends Seeder
// Test Sites 254 & 255
$o = new Site;
$o->id = 254;
// $o->date_orig
$o->active = TRUE;
$o->site_id = 254;
$o->country_id = 61;
@ -32,7 +31,6 @@ class SiteTableSeeder extends Seeder
// Test Sites 254 & 255
$o = new Site;
$o->id = 255;
// $o->date_orig
$o->site_id = 255;
$o->active = TRUE;
$o->country_id = 61;

View File

@ -17,10 +17,9 @@ class UserTableSeeder extends Seeder
{
$o = new User;
$o->id = 1;
$o->site_id = 1;
$o->site_id = 254;
$o->language_id = 1;
$o->country_id = 61;
$o->currency_id = 6;
$o->active = 1;
$o->firstname = 'Wholesaler';
$o->lastname = 'User';
@ -29,10 +28,9 @@ class UserTableSeeder extends Seeder
$o = new User;
$o->id = 10;
$o->site_id = 1;
$o->site_id = 254;
$o->language_id = 1;
$o->country_id = 61;
$o->currency_id = 6;
$o->active = 1;
$o->firstname = 'reseller1-0';
$o->lastname = 'User';
@ -41,10 +39,9 @@ class UserTableSeeder extends Seeder
$o = new User;
$o->id = 11;
$o->site_id = 1;
$o->site_id = 254;
$o->language_id = 1;
$o->country_id = 61;
$o->currency_id = 6;
$o->active = 1;
$o->firstname = 'reseller2-0';
$o->lastname = 'User';
@ -53,10 +50,9 @@ class UserTableSeeder extends Seeder
$o = new User;
$o->id = 110;
$o->site_id = 1;
$o->site_id = 254;
$o->language_id = 1;
$o->country_id = 61;
$o->currency_id = 6;
$o->active = 1;
$o->firstname = 'reseller2-1';
$o->lastname = 'User';
@ -65,10 +61,9 @@ class UserTableSeeder extends Seeder
$o = new User;
$o->id = 1010;
$o->site_id = 1;
$o->site_id = 254;
$o->language_id = 1;
$o->country_id = 61;
$o->currency_id = 6;
$o->active = 1;
$o->firstname = 'user1-0-1';
$o->lastname = 'User';
@ -77,10 +72,9 @@ class UserTableSeeder extends Seeder
$o = new User;
$o->id = 1110;
$o->site_id = 1;
$o->site_id = 254;
$o->language_id = 1;
$o->country_id = 61;
$o->currency_id = 6;
$o->active = 1;
$o->firstname = 'user2-1-1';
$o->lastname = 'User';