core updates for seeding and testing
This commit is contained in:
@@ -14,8 +14,5 @@ class AuditTrailDatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Model::unguard();
|
||||
|
||||
// $this->call("OthersTableSeeder");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ class CountriesDatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->command?->info('Running CountriesDatabaseSeeder');
|
||||
$this->call([
|
||||
IsoCountriesSeeder::class,
|
||||
IsoCountrySubdivisionsSeeder::class,
|
||||
|
||||
@@ -7,6 +7,9 @@ namespace Modules\Helpdesk\Concerns;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Modules\Helpdesk\Models\Ticket;
|
||||
|
||||
/**
|
||||
* @method hasMany(string $class, string $string)
|
||||
*/
|
||||
trait HasHelpdeskTickets
|
||||
{
|
||||
/** @return HasMany<Ticket> */
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Pricing\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PricingDatabaseSeeder extends Seeder
|
||||
final class PricingDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
public function run(): void
|
||||
{
|
||||
DB::table('platform_prices')->insert([
|
||||
$plans = [
|
||||
[
|
||||
'code' => 'basic',
|
||||
'name' => 'Basic',
|
||||
@@ -24,12 +24,15 @@ class PricingDatabaseSeeder extends Seeder
|
||||
'annual_amount' => 49000,
|
||||
'currency' => 'gbp',
|
||||
'badge_label' => 'Starter',
|
||||
'features' => json_encode(['Warehouse dashboard', 'Inventory overview', 'Basic audit trail', 'Email support']),
|
||||
'features' => [
|
||||
'Warehouse dashboard',
|
||||
'Inventory overview',
|
||||
'Basic audit trail',
|
||||
'Email support',
|
||||
],
|
||||
'sort_order' => 10,
|
||||
'is_featured' => false,
|
||||
'is_active' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'code' => 'advanced',
|
||||
@@ -40,12 +43,16 @@ class PricingDatabaseSeeder extends Seeder
|
||||
'annual_amount' => 99000,
|
||||
'currency' => 'gbp',
|
||||
'badge_label' => 'Popular',
|
||||
'features' => json_encode(['Everything in Basic', 'Replenishment workflows', 'Reporting workspace', 'M3 integration status', 'Priority support']),
|
||||
'features' => [
|
||||
'Everything in Basic',
|
||||
'Replenishment workflows',
|
||||
'Reporting workspace',
|
||||
'M3 integration status',
|
||||
'Priority support',
|
||||
],
|
||||
'sort_order' => 20,
|
||||
'is_featured' => true,
|
||||
'is_active' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'code' => 'pro',
|
||||
@@ -56,29 +63,69 @@ class PricingDatabaseSeeder extends Seeder
|
||||
'annual_amount' => 199000,
|
||||
'currency' => 'gbp',
|
||||
'badge_label' => 'Enterprise',
|
||||
'features' => json_encode(['Everything in Advanced', 'Multi-company administration', 'Security and audit controls', 'Document archive', 'Carrier management', 'Dedicated support']),
|
||||
'features' => [
|
||||
'Everything in Advanced',
|
||||
'Multi-company administration',
|
||||
'Security and audit controls',
|
||||
'Document archive',
|
||||
'Carrier management',
|
||||
'Dedicated support',
|
||||
],
|
||||
'sort_order' => 30,
|
||||
'is_featured' => false,
|
||||
'is_active' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'code' => 'ultimate',
|
||||
'name' => 'Ultimate',
|
||||
'strapline' => 'Ultimate Enterprise Grade Administration',
|
||||
'description' => 'Full platform administration for regulated warehouse,unlimited warehouses and users, carrier and document operations.',
|
||||
'description' => 'Full platform administration for regulated warehouse, unlimited warehouses and users, carrier and document operations.',
|
||||
'monthly_amount' => 1009900,
|
||||
'annual_amount' => 1000000,
|
||||
'currency' => 'gbp',
|
||||
'badge_label' => 'Enterprise',
|
||||
'features' => json_encode(['Everything in pro', 'Multi-company administration', 'Security and audit controls', 'Document archive', 'Carrier management', 'Dedicated support']),
|
||||
'features' => [
|
||||
'Everything in Pro',
|
||||
'Multi-company administration',
|
||||
'Security and audit controls',
|
||||
'Document archive',
|
||||
'Carrier management',
|
||||
'Dedicated support',
|
||||
],
|
||||
'sort_order' => 50,
|
||||
'is_featured' => false,
|
||||
'is_active' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
]);
|
||||
];
|
||||
|
||||
foreach ($plans as $plan) {
|
||||
$exists = DB::table('platform_prices')
|
||||
->where('code', $plan['code'])
|
||||
->exists();
|
||||
|
||||
$payload = [
|
||||
'name' => $plan['name'],
|
||||
'strapline' => $plan['strapline'],
|
||||
'description' => $plan['description'],
|
||||
'monthly_amount' => $plan['monthly_amount'],
|
||||
'annual_amount' => $plan['annual_amount'],
|
||||
'currency' => $plan['currency'],
|
||||
'badge_label' => $plan['badge_label'],
|
||||
'features' => json_encode($plan['features'], JSON_THROW_ON_ERROR),
|
||||
'sort_order' => $plan['sort_order'],
|
||||
'is_featured' => $plan['is_featured'],
|
||||
'is_active' => $plan['is_active'],
|
||||
'updated_at' => now(),
|
||||
];
|
||||
|
||||
if (! $exists) {
|
||||
$payload['created_at'] = now();
|
||||
}
|
||||
|
||||
DB::table('platform_prices')->updateOrInsert(
|
||||
['code' => $plan['code']],
|
||||
$payload
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user