diff --git a/app/Services/DemoCoreService.php b/app/Services/DemoCoreService.php index f01dac880..28605dd41 100644 --- a/app/Services/DemoCoreService.php +++ b/app/Services/DemoCoreService.php @@ -8,6 +8,7 @@ use App\Models\Procurement; use App\Models\Product; use App\Models\Provider; +use App\Models\Role; use App\Models\Tax; use App\Models\TaxGroup; use App\Models\Unit; @@ -62,7 +63,7 @@ public function prepareDefaultUnitSystem() if ( ! $group instanceof UnitGroup ) { $group = new UnitGroup; $group->name = __( 'Countable' ); - $group->author = Auth::id(); + $group->author = Role::namespace( 'admin' )->users()->first()->id; $group->save(); } @@ -73,7 +74,7 @@ public function prepareDefaultUnitSystem() $unit->name = __( 'Piece' ); $unit->identifier = 'piece'; $unit->description = ''; - $unit->author = Auth::id(); + $unit->author = Role::namespace( 'admin' )->users()->first()->id; $unit->group_id = $group->id; $unit->base_unit = true; $unit->value = 1; @@ -87,7 +88,7 @@ public function prepareDefaultUnitSystem() $unit->name = __( 'Small Box' ); $unit->identifier = 'small-box'; $unit->description = ''; - $unit->author = Auth::id(); + $unit->author = Role::namespace( 'admin' )->users()->first()->id; $unit->group_id = $group->id; $unit->base_unit = true; $unit->value = 6; @@ -101,7 +102,7 @@ public function prepareDefaultUnitSystem() $unit->name = __( 'Box' ); $unit->identifier = 'box'; $unit->description = ''; - $unit->author = Auth::id(); + $unit->author = Role::namespace( 'admin' )->users()->first()->id; $unit->group_id = $group->id; $unit->base_unit = true; $unit->value = 12; @@ -213,7 +214,7 @@ public function createTaxes() if ( ! $taxGroup instanceof TaxGroup ) { $taxGroup = new TaxGroup; $taxGroup->name = __( 'GST' ); - $taxGroup->author = Auth::id(); + $taxGroup->author = Role::namespace( 'admin' )->users()->first()->id; $taxGroup->save(); } @@ -224,7 +225,7 @@ public function createTaxes() $tax->name = __( 'SGST' ); $tax->rate = 8; $tax->tax_group_id = $taxGroup->id; - $tax->author = Auth::id(); + $tax->author = Role::namespace( 'admin' )->users()->first()->id; $tax->save(); } @@ -235,7 +236,7 @@ public function createTaxes() $tax->name = __( 'CGST' ); $tax->rate = 8; $tax->tax_group_id = $taxGroup->id; - $tax->author = Auth::id(); + $tax->author = Role::namespace( 'admin' )->users()->first()->id; $tax->save(); } }