Sfoglia il codice sorgente

Revert "wip"

This reverts commit f4cec2dbf9.
3.x
Andrew Wallo 4 mesi fa
parent
commit
67c644d08f

+ 1
- 1
database/factories/Accounting/InvoiceFactory.php Vedi File

@@ -178,7 +178,7 @@ class InvoiceFactory extends Factory
178 178
     {
179 179
         $invoice->refresh();
180 180
 
181
-        $amountDue = $invoice->amount_due;
181
+        $amountDue = $invoice->getRawOriginal('amount_due');
182 182
 
183 183
         $totalAmountDue = match ($invoiceStatus) {
184 184
             InvoiceStatus::Overpaid => $amountDue + random_int(1000, 10000),

+ 56
- 3
database/seeders/DatabaseSeeder.php Vedi File

@@ -2,6 +2,9 @@
2 2
 
3 3
 namespace Database\Seeders;
4 4
 
5
+use App\Models\Company;
6
+use App\Models\User;
7
+use Database\Factories\CompanyFactory;
5 8
 use Illuminate\Database\Seeder;
6 9
 
7 10
 class DatabaseSeeder extends Seeder
@@ -11,8 +14,58 @@ class DatabaseSeeder extends Seeder
11 14
      */
12 15
     public function run(): void
13 16
     {
14
-        $this->call([
15
-            UserCompanySeeder::class,
16
-        ]);
17
+        // Create a single admin user and their personal company
18
+        $user = User::factory()
19
+            ->withPersonalCompany(function (CompanyFactory $factory) {
20
+                return $factory
21
+                    ->state([
22
+                        'name' => 'ERPSAAS',
23
+                    ])
24
+                    ->withTransactions(250)
25
+                    ->withOfferings()
26
+                    ->withClients()
27
+                    ->withVendors()
28
+                    ->withInvoices(30)
29
+                    ->withRecurringInvoices()
30
+                    ->withEstimates(30)
31
+                    ->withBills(30);
32
+            })
33
+            ->create([
34
+                'name' => 'Admin',
35
+                'email' => 'admin@erpsaas.com',
36
+                'password' => bcrypt('password'),
37
+                'current_company_id' => 1,  // Assuming this will be the ID of the created company
38
+            ]);
39
+
40
+        // Only use en locale for now
41
+        $additionalCompanies = [
42
+            ['name' => 'British Crown Analytics', 'country' => 'GB', 'currency' => 'GBP', 'locale' => 'en'],
43
+            ['name' => 'Swiss Precision Group', 'country' => 'CH', 'currency' => 'CHF', 'locale' => 'en'],
44
+            ['name' => 'Tokyo Future Technologies', 'country' => 'JP', 'currency' => 'JPY', 'locale' => 'en'],
45
+            ['name' => 'Sydney Harbor Systems', 'country' => 'AU', 'currency' => 'AUD', 'locale' => 'en'],
46
+            ['name' => 'Mumbai Software Services', 'country' => 'IN', 'currency' => 'INR', 'locale' => 'en'],
47
+            ['name' => 'Singapore Digital Hub', 'country' => 'SG', 'currency' => 'SGD', 'locale' => 'en'],
48
+            ['name' => 'Dubai Business Consulting', 'country' => 'AE', 'currency' => 'AED', 'locale' => 'en'],
49
+        ];
50
+
51
+        foreach ($additionalCompanies as $companyData) {
52
+            Company::factory()
53
+                ->state([
54
+                    'name' => $companyData['name'],
55
+                    'user_id' => $user->id,
56
+                    'personal_company' => false,
57
+                ])
58
+                ->withCompanyProfile($companyData['country'])
59
+                ->withCompanyDefaults($companyData['currency'], $companyData['locale'])
60
+                ->withTransactions(100)
61
+                ->withOfferings()
62
+                ->withClients()
63
+                ->withVendors()
64
+                ->withInvoices(15)
65
+                ->withRecurringInvoices()
66
+                ->withEstimates(15)
67
+                ->withBills(15)
68
+                ->create();
69
+        }
17 70
     }
18 71
 }

+ 0
- 66
database/seeders/UserCompanySeeder.php Vedi File

@@ -1,66 +0,0 @@
1
-<?php
2
-
3
-namespace Database\Seeders;
4
-
5
-use App\Models\Company;
6
-use App\Models\User;
7
-use Database\Factories\CompanyFactory;
8
-use Illuminate\Database\Seeder;
9
-
10
-class UserCompanySeeder extends Seeder
11
-{
12
-    /**
13
-     * Run the database seeds.
14
-     */
15
-    public function run(): void
16
-    {
17
-        // Create a single admin user and their personal company
18
-        $user = User::factory()
19
-            ->withPersonalCompany(function (CompanyFactory $factory) {
20
-                return $factory
21
-                    ->state([
22
-                        'name' => 'ERPSAAS',
23
-                    ])
24
-                    ->withTransactions(250)
25
-                    ->withOfferings()
26
-                    ->withClients()
27
-                    ->withVendors()
28
-                    ->withInvoices(30)
29
-                    ->withRecurringInvoices()
30
-                    ->withEstimates(30)
31
-                    ->withBills(30);
32
-            })
33
-            ->create([
34
-                'name' => 'Admin',
35
-                'email' => 'admin@erpsaas.com',
36
-                'password' => bcrypt('password'),
37
-                'current_company_id' => 1,  // Assuming this will be the ID of the created company
38
-            ]);
39
-
40
-        $additionalCompanies = [
41
-            ['name' => 'British Crown Analytics', 'country' => 'GB', 'currency' => 'GBP', 'locale' => 'en'],
42
-            ['name' => 'Berlin Tech Solutions', 'country' => 'DE', 'currency' => 'EUR', 'locale' => 'en'],
43
-            ['name' => 'Mumbai Software Services', 'country' => 'IN', 'currency' => 'INR', 'locale' => 'en'],
44
-        ];
45
-
46
-        foreach ($additionalCompanies as $companyData) {
47
-            Company::factory()
48
-                ->state([
49
-                    'name' => $companyData['name'],
50
-                    'user_id' => $user->id,
51
-                    'personal_company' => false,
52
-                ])
53
-                ->withCompanyProfile($companyData['country'])
54
-                ->withCompanyDefaults($companyData['currency'], $companyData['locale'])
55
-                ->withTransactions(50)
56
-                ->withOfferings()
57
-                ->withClients()
58
-                ->withVendors()
59
-                ->withInvoices()
60
-                ->withRecurringInvoices()
61
-                ->withEstimates()
62
-                ->withBills()
63
-                ->create();
64
-        }
65
-    }
66
-}

Loading…
Annulla
Salva