瀏覽代碼

refactor and prevent auto creation of company for Socialite User

3.x
wallo 2 年之前
父節點
當前提交
2d8346f605

+ 2
- 0
.gitignore 查看文件

17
 /.fleet
17
 /.fleet
18
 /.idea
18
 /.idea
19
 /.vscode
19
 /.vscode
20
+/public/css/
21
+/public/js/

+ 1
- 1
app/Actions/FilamentCompanies/CreateUserFromProvider.php 查看文件

46
                     $this->createsConnectedAccounts->create($user, $provider, $providerUser)
46
                     $this->createsConnectedAccounts->create($user, $provider, $providerUser)
47
                 );
47
                 );
48
 
48
 
49
-                $this->createCompany($user);
49
+                // $this->createCompany($user); // Commented out to prevent creating a company for a Socialite user
50
             });
50
             });
51
         });
51
         });
52
     }
52
     }

+ 27
- 0
app/Events/CompanyGenerated.php 查看文件

1
+<?php
2
+
3
+namespace App\Events;
4
+
5
+use App\Models\Company;
6
+use App\Models\User;
7
+use Illuminate\Foundation\Events\Dispatchable;
8
+use Illuminate\Queue\SerializesModels;
9
+
10
+class CompanyGenerated
11
+{
12
+    use Dispatchable, SerializesModels;
13
+
14
+    public User $user;
15
+    public Company $company;
16
+    public string $country;
17
+
18
+    /**
19
+     * Create a new event instance.
20
+     */
21
+    public function __construct(User $user, Company $company, string $country)
22
+    {
23
+        $this->user = $user;
24
+        $this->company = $company;
25
+        $this->country = $country;
26
+    }
27
+}

+ 3
- 0
app/Filament/Company/Pages/CreateCompany.php 查看文件

3
 namespace App\Filament\Company\Pages;
3
 namespace App\Filament\Company\Pages;
4
 
4
 
5
 use App\Enums\EntityType;
5
 use App\Enums\EntityType;
6
+use App\Events\CompanyGenerated;
6
 use App\Models\Setting\CompanyProfile;
7
 use App\Models\Setting\CompanyProfile;
7
 use Filament\Forms\Components\Select;
8
 use Filament\Forms\Components\Select;
8
 use Filament\Forms\Components\TextInput;
9
 use Filament\Forms\Components\TextInput;
70
 
71
 
71
         $name = $data['name'];
72
         $name = $data['name'];
72
 
73
 
74
+        CompanyGenerated::dispatch($user, $company, $data['profile']['country']);
75
+
73
         $this->companyCreated($name);
76
         $this->companyCreated($name);
74
 
77
 
75
         return $company;
78
         return $company;

+ 6
- 5
app/Listeners/CreateCompanyDefaults.php 查看文件

2
 
2
 
3
 namespace App\Listeners;
3
 namespace App\Listeners;
4
 
4
 
5
-use App\Models\Company;
5
+use App\Events\CompanyGenerated;
6
 use App\Services\CompanyDefaultService;
6
 use App\Services\CompanyDefaultService;
7
-use Wallo\FilamentCompanies\Events\CompanyCreated;
8
 
7
 
9
 class CreateCompanyDefaults
8
 class CreateCompanyDefaults
10
 {
9
 {
19
     /**
18
     /**
20
      * Handle the event.
19
      * Handle the event.
21
      */
20
      */
22
-    public function handle(CompanyCreated $event): void
21
+    public function handle(CompanyGenerated $event): void
23
     {
22
     {
24
-        /** @var Company $company */
25
         $company = $event->company;
23
         $company = $event->company;
24
+        $country = $event->country;
25
+
26
+        $currencyCode = $country ? country($country)->getCurrency()['iso_4217_code'] : 'USD';
26
 
27
 
27
         $user = $company->owner;
28
         $user = $company->owner;
28
 
29
 
29
         $companyDefaultService = new CompanyDefaultService();
30
         $companyDefaultService = new CompanyDefaultService();
30
-        $companyDefaultService->createCompanyDefaults($company, $user);
31
+        $companyDefaultService->createCompanyDefaults($company, $user, $currencyCode);
31
     }
32
     }
32
 }
33
 }

+ 2
- 2
app/Providers/EventServiceProvider.php 查看文件

4
 
4
 
5
 use App\Events\CompanyDefaultEvent;
5
 use App\Events\CompanyDefaultEvent;
6
 use App\Events\CompanyDefaultUpdated;
6
 use App\Events\CompanyDefaultUpdated;
7
+use App\Events\CompanyGenerated;
7
 use App\Listeners\ConfigureCompanyDefault;
8
 use App\Listeners\ConfigureCompanyDefault;
8
 use App\Listeners\CreateCompanyDefaults;
9
 use App\Listeners\CreateCompanyDefaults;
9
 use App\Listeners\SyncAssociatedModels;
10
 use App\Listeners\SyncAssociatedModels;
12
 use Illuminate\Auth\Events\Registered;
13
 use Illuminate\Auth\Events\Registered;
13
 use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
14
 use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
14
 use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
15
 use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
15
-use Wallo\FilamentCompanies\Events\CompanyCreated;
16
 
16
 
17
 class EventServiceProvider extends ServiceProvider
17
 class EventServiceProvider extends ServiceProvider
18
 {
18
 {
34
         TenantSet::class => [
34
         TenantSet::class => [
35
             ConfigureCompanyDefault::class,
35
             ConfigureCompanyDefault::class,
36
         ],
36
         ],
37
-        CompanyCreated::class => [
37
+        CompanyGenerated::class => [
38
             CreateCompanyDefaults::class,
38
             CreateCompanyDefaults::class,
39
         ],
39
         ],
40
     ];
40
     ];

+ 6
- 7
app/Services/CompanyDefaultService.php 查看文件

12
 use App\Models\Setting\DocumentDefault;
12
 use App\Models\Setting\DocumentDefault;
13
 use App\Models\Setting\Tax;
13
 use App\Models\Setting\Tax;
14
 use App\Models\User;
14
 use App\Models\User;
15
-use Illuminate\Support\Facades\Auth;
16
 use Illuminate\Support\Facades\DB;
15
 use Illuminate\Support\Facades\DB;
17
 
16
 
18
 class CompanyDefaultService
17
 class CompanyDefaultService
19
 {
18
 {
20
-    public function createCompanyDefaults(Company $company, User $user): void
19
+    public function createCompanyDefaults(Company $company, User $user, string $currencyCode): void
21
     {
20
     {
22
-        DB::transaction(function () use ($company, $user) {
21
+        DB::transaction(function () use ($company, $user, $currencyCode) {
23
             $categories = $this->createCategories($company, $user);
22
             $categories = $this->createCategories($company, $user);
24
-            $currency = $this->createCurrency($company, $user);
23
+            $currency = $this->createCurrency($company, $user, $currencyCode);
25
             $salesTax = $this->createSalesTax($company, $user);
24
             $salesTax = $this->createSalesTax($company, $user);
26
             $purchaseTax = $this->createPurchaseTax($company, $user);
25
             $purchaseTax = $this->createPurchaseTax($company, $user);
27
             $salesDiscount = $this->createSalesDiscount($company, $user);
26
             $salesDiscount = $this->createSalesDiscount($company, $user);
42
                 'updated_by' => $user->id,
41
                 'updated_by' => $user->id,
43
             ];
42
             ];
44
 
43
 
45
-            CompanyDefault::updateOrInsert(['company_id' => $company->id], $companyDefaults);
44
+            CompanyDefault::firstOrCreate(['company_id' => $company->id], $companyDefaults);
46
         }, 5);
45
         }, 5);
47
     }
46
     }
48
 
47
 
93
         ];
92
         ];
94
     }
93
     }
95
 
94
 
96
-    private function createCurrency(Company $company, User $user)
95
+    private function createCurrency(Company $company, User $user, string $currencyCode)
97
     {
96
     {
98
-        return Currency::factory()->create([
97
+        return Currency::factory()->forCurrency($currencyCode)->create([
99
             'company_id' => $company->id,
98
             'company_id' => $company->id,
100
             'created_by' => $user->id,
99
             'created_by' => $user->id,
101
             'updated_by' => $user->id,
100
             'updated_by' => $user->id,

+ 2
- 2
app/Traits/SyncsWithCompanyDefaults.php 查看文件

8
 {
8
 {
9
     public static function bootSyncsWithCompanyDefaults(): void
9
     public static function bootSyncsWithCompanyDefaults(): void
10
     {
10
     {
11
-        static::creating(static function ($model) {
11
+        static::created(static function ($model) {
12
             event(new CompanyDefaultEvent($model));
12
             event(new CompanyDefaultEvent($model));
13
         });
13
         });
14
 
14
 
15
-        static::updating(static function ($model) {
15
+        static::updated(static function ($model) {
16
             event(new CompanyDefaultEvent($model));
16
             event(new CompanyDefaultEvent($model));
17
         });
17
         });
18
     }
18
     }

+ 58
- 54
composer.lock 查看文件

1234
         },
1234
         },
1235
         {
1235
         {
1236
             "name": "filament/actions",
1236
             "name": "filament/actions",
1237
-            "version": "v3.0.52",
1237
+            "version": "v3.0.53",
1238
             "source": {
1238
             "source": {
1239
                 "type": "git",
1239
                 "type": "git",
1240
                 "url": "https://github.com/filamentphp/actions.git",
1240
                 "url": "https://github.com/filamentphp/actions.git",
1241
-                "reference": "1d8b7e393f9a783d674768e3b9f54e76a357b2e6"
1241
+                "reference": "ab3512faf3a0e35e3b863b78ac4c67eede8f654f"
1242
             },
1242
             },
1243
             "dist": {
1243
             "dist": {
1244
                 "type": "zip",
1244
                 "type": "zip",
1245
-                "url": "https://api.github.com/repos/filamentphp/actions/zipball/1d8b7e393f9a783d674768e3b9f54e76a357b2e6",
1246
-                "reference": "1d8b7e393f9a783d674768e3b9f54e76a357b2e6",
1245
+                "url": "https://api.github.com/repos/filamentphp/actions/zipball/ab3512faf3a0e35e3b863b78ac4c67eede8f654f",
1246
+                "reference": "ab3512faf3a0e35e3b863b78ac4c67eede8f654f",
1247
                 "shasum": ""
1247
                 "shasum": ""
1248
             },
1248
             },
1249
             "require": {
1249
             "require": {
1280
                 "issues": "https://github.com/filamentphp/filament/issues",
1280
                 "issues": "https://github.com/filamentphp/filament/issues",
1281
                 "source": "https://github.com/filamentphp/filament"
1281
                 "source": "https://github.com/filamentphp/filament"
1282
             },
1282
             },
1283
-            "time": "2023-09-11T12:30:47+00:00"
1283
+            "time": "2023-09-18T10:30:31+00:00"
1284
         },
1284
         },
1285
         {
1285
         {
1286
             "name": "filament/filament",
1286
             "name": "filament/filament",
1287
-            "version": "v3.0.52",
1287
+            "version": "v3.0.53",
1288
             "source": {
1288
             "source": {
1289
                 "type": "git",
1289
                 "type": "git",
1290
                 "url": "https://github.com/filamentphp/panels.git",
1290
                 "url": "https://github.com/filamentphp/panels.git",
1291
-                "reference": "6a9e8b82ab7e5e639621f53c8982d2bef1322566"
1291
+                "reference": "0fba2ff378d28984e9d0107600a8dff5e2425d8b"
1292
             },
1292
             },
1293
             "dist": {
1293
             "dist": {
1294
                 "type": "zip",
1294
                 "type": "zip",
1295
-                "url": "https://api.github.com/repos/filamentphp/panels/zipball/6a9e8b82ab7e5e639621f53c8982d2bef1322566",
1296
-                "reference": "6a9e8b82ab7e5e639621f53c8982d2bef1322566",
1295
+                "url": "https://api.github.com/repos/filamentphp/panels/zipball/0fba2ff378d28984e9d0107600a8dff5e2425d8b",
1296
+                "reference": "0fba2ff378d28984e9d0107600a8dff5e2425d8b",
1297
                 "shasum": ""
1297
                 "shasum": ""
1298
             },
1298
             },
1299
             "require": {
1299
             "require": {
1345
                 "issues": "https://github.com/filamentphp/filament/issues",
1345
                 "issues": "https://github.com/filamentphp/filament/issues",
1346
                 "source": "https://github.com/filamentphp/filament"
1346
                 "source": "https://github.com/filamentphp/filament"
1347
             },
1347
             },
1348
-            "time": "2023-09-16T10:25:57+00:00"
1348
+            "time": "2023-09-18T10:30:37+00:00"
1349
         },
1349
         },
1350
         {
1350
         {
1351
             "name": "filament/forms",
1351
             "name": "filament/forms",
1352
-            "version": "v3.0.52",
1352
+            "version": "v3.0.53",
1353
             "source": {
1353
             "source": {
1354
                 "type": "git",
1354
                 "type": "git",
1355
                 "url": "https://github.com/filamentphp/forms.git",
1355
                 "url": "https://github.com/filamentphp/forms.git",
1356
-                "reference": "b99b4dfd957df9cebafaee6d95f1de5132221353"
1356
+                "reference": "9b7dc160634649c411fdbeeee4058bd524b30088"
1357
             },
1357
             },
1358
             "dist": {
1358
             "dist": {
1359
                 "type": "zip",
1359
                 "type": "zip",
1360
-                "url": "https://api.github.com/repos/filamentphp/forms/zipball/b99b4dfd957df9cebafaee6d95f1de5132221353",
1361
-                "reference": "b99b4dfd957df9cebafaee6d95f1de5132221353",
1360
+                "url": "https://api.github.com/repos/filamentphp/forms/zipball/9b7dc160634649c411fdbeeee4058bd524b30088",
1361
+                "reference": "9b7dc160634649c411fdbeeee4058bd524b30088",
1362
                 "shasum": ""
1362
                 "shasum": ""
1363
             },
1363
             },
1364
             "require": {
1364
             "require": {
1401
                 "issues": "https://github.com/filamentphp/filament/issues",
1401
                 "issues": "https://github.com/filamentphp/filament/issues",
1402
                 "source": "https://github.com/filamentphp/filament"
1402
                 "source": "https://github.com/filamentphp/filament"
1403
             },
1403
             },
1404
-            "time": "2023-09-16T10:25:51+00:00"
1404
+            "time": "2023-09-18T10:30:39+00:00"
1405
         },
1405
         },
1406
         {
1406
         {
1407
             "name": "filament/infolists",
1407
             "name": "filament/infolists",
1408
-            "version": "v3.0.52",
1408
+            "version": "v3.0.53",
1409
             "source": {
1409
             "source": {
1410
                 "type": "git",
1410
                 "type": "git",
1411
                 "url": "https://github.com/filamentphp/infolists.git",
1411
                 "url": "https://github.com/filamentphp/infolists.git",
1412
-                "reference": "db3f36f1fa243213996262f1afdce76aba497f7b"
1412
+                "reference": "148b6f2bc0c27c224dc0fd811882dd080eb50a6e"
1413
             },
1413
             },
1414
             "dist": {
1414
             "dist": {
1415
                 "type": "zip",
1415
                 "type": "zip",
1416
-                "url": "https://api.github.com/repos/filamentphp/infolists/zipball/db3f36f1fa243213996262f1afdce76aba497f7b",
1417
-                "reference": "db3f36f1fa243213996262f1afdce76aba497f7b",
1416
+                "url": "https://api.github.com/repos/filamentphp/infolists/zipball/148b6f2bc0c27c224dc0fd811882dd080eb50a6e",
1417
+                "reference": "148b6f2bc0c27c224dc0fd811882dd080eb50a6e",
1418
                 "shasum": ""
1418
                 "shasum": ""
1419
             },
1419
             },
1420
             "require": {
1420
             "require": {
1452
                 "issues": "https://github.com/filamentphp/filament/issues",
1452
                 "issues": "https://github.com/filamentphp/filament/issues",
1453
                 "source": "https://github.com/filamentphp/filament"
1453
                 "source": "https://github.com/filamentphp/filament"
1454
             },
1454
             },
1455
-            "time": "2023-09-11T12:30:48+00:00"
1455
+            "time": "2023-09-18T10:30:36+00:00"
1456
         },
1456
         },
1457
         {
1457
         {
1458
             "name": "filament/notifications",
1458
             "name": "filament/notifications",
1459
-            "version": "v3.0.52",
1459
+            "version": "v3.0.53",
1460
             "source": {
1460
             "source": {
1461
                 "type": "git",
1461
                 "type": "git",
1462
                 "url": "https://github.com/filamentphp/notifications.git",
1462
                 "url": "https://github.com/filamentphp/notifications.git",
1463
-                "reference": "b675b8310bb4984334bc5b01b3b770a6b0d56a83"
1463
+                "reference": "288355f86d973a69bd483836b9a38d000b8b2ad2"
1464
             },
1464
             },
1465
             "dist": {
1465
             "dist": {
1466
                 "type": "zip",
1466
                 "type": "zip",
1467
-                "url": "https://api.github.com/repos/filamentphp/notifications/zipball/b675b8310bb4984334bc5b01b3b770a6b0d56a83",
1468
-                "reference": "b675b8310bb4984334bc5b01b3b770a6b0d56a83",
1467
+                "url": "https://api.github.com/repos/filamentphp/notifications/zipball/288355f86d973a69bd483836b9a38d000b8b2ad2",
1468
+                "reference": "288355f86d973a69bd483836b9a38d000b8b2ad2",
1469
                 "shasum": ""
1469
                 "shasum": ""
1470
             },
1470
             },
1471
             "require": {
1471
             "require": {
1504
                 "issues": "https://github.com/filamentphp/filament/issues",
1504
                 "issues": "https://github.com/filamentphp/filament/issues",
1505
                 "source": "https://github.com/filamentphp/filament"
1505
                 "source": "https://github.com/filamentphp/filament"
1506
             },
1506
             },
1507
-            "time": "2023-09-06T14:23:07+00:00"
1507
+            "time": "2023-09-18T10:30:34+00:00"
1508
         },
1508
         },
1509
         {
1509
         {
1510
             "name": "filament/spatie-laravel-tags-plugin",
1510
             "name": "filament/spatie-laravel-tags-plugin",
1511
-            "version": "v3.0.52",
1511
+            "version": "v3.0.53",
1512
             "source": {
1512
             "source": {
1513
                 "type": "git",
1513
                 "type": "git",
1514
                 "url": "https://github.com/filamentphp/spatie-laravel-tags-plugin.git",
1514
                 "url": "https://github.com/filamentphp/spatie-laravel-tags-plugin.git",
1545
         },
1545
         },
1546
         {
1546
         {
1547
             "name": "filament/support",
1547
             "name": "filament/support",
1548
-            "version": "v3.0.52",
1548
+            "version": "v3.0.53",
1549
             "source": {
1549
             "source": {
1550
                 "type": "git",
1550
                 "type": "git",
1551
                 "url": "https://github.com/filamentphp/support.git",
1551
                 "url": "https://github.com/filamentphp/support.git",
1552
-                "reference": "183354b6fe1af1bbda335818c2e412fb7c1869e9"
1552
+                "reference": "9f6fa9a2c03f45eccbca83a083535fb628f73b97"
1553
             },
1553
             },
1554
             "dist": {
1554
             "dist": {
1555
                 "type": "zip",
1555
                 "type": "zip",
1556
-                "url": "https://api.github.com/repos/filamentphp/support/zipball/183354b6fe1af1bbda335818c2e412fb7c1869e9",
1557
-                "reference": "183354b6fe1af1bbda335818c2e412fb7c1869e9",
1556
+                "url": "https://api.github.com/repos/filamentphp/support/zipball/9f6fa9a2c03f45eccbca83a083535fb628f73b97",
1557
+                "reference": "9f6fa9a2c03f45eccbca83a083535fb628f73b97",
1558
                 "shasum": ""
1558
                 "shasum": ""
1559
             },
1559
             },
1560
             "require": {
1560
             "require": {
1598
                 "issues": "https://github.com/filamentphp/filament/issues",
1598
                 "issues": "https://github.com/filamentphp/filament/issues",
1599
                 "source": "https://github.com/filamentphp/filament"
1599
                 "source": "https://github.com/filamentphp/filament"
1600
             },
1600
             },
1601
-            "time": "2023-09-16T10:26:04+00:00"
1601
+            "time": "2023-09-18T10:30:36+00:00"
1602
         },
1602
         },
1603
         {
1603
         {
1604
             "name": "filament/tables",
1604
             "name": "filament/tables",
1605
-            "version": "v3.0.52",
1605
+            "version": "v3.0.53",
1606
             "source": {
1606
             "source": {
1607
                 "type": "git",
1607
                 "type": "git",
1608
                 "url": "https://github.com/filamentphp/tables.git",
1608
                 "url": "https://github.com/filamentphp/tables.git",
1609
-                "reference": "0cd15c2591f42d6528e65e99cf16f34c134904ad"
1609
+                "reference": "bf7110bceca30534038fe7e5344c236860636e27"
1610
             },
1610
             },
1611
             "dist": {
1611
             "dist": {
1612
                 "type": "zip",
1612
                 "type": "zip",
1613
-                "url": "https://api.github.com/repos/filamentphp/tables/zipball/0cd15c2591f42d6528e65e99cf16f34c134904ad",
1614
-                "reference": "0cd15c2591f42d6528e65e99cf16f34c134904ad",
1613
+                "url": "https://api.github.com/repos/filamentphp/tables/zipball/bf7110bceca30534038fe7e5344c236860636e27",
1614
+                "reference": "bf7110bceca30534038fe7e5344c236860636e27",
1615
                 "shasum": ""
1615
                 "shasum": ""
1616
             },
1616
             },
1617
             "require": {
1617
             "require": {
1651
                 "issues": "https://github.com/filamentphp/filament/issues",
1651
                 "issues": "https://github.com/filamentphp/filament/issues",
1652
                 "source": "https://github.com/filamentphp/filament"
1652
                 "source": "https://github.com/filamentphp/filament"
1653
             },
1653
             },
1654
-            "time": "2023-09-16T10:26:09+00:00"
1654
+            "time": "2023-09-18T10:30:31+00:00"
1655
         },
1655
         },
1656
         {
1656
         {
1657
             "name": "filament/widgets",
1657
             "name": "filament/widgets",
1658
-            "version": "v3.0.52",
1658
+            "version": "v3.0.53",
1659
             "source": {
1659
             "source": {
1660
                 "type": "git",
1660
                 "type": "git",
1661
                 "url": "https://github.com/filamentphp/widgets.git",
1661
                 "url": "https://github.com/filamentphp/widgets.git",
1662
-                "reference": "11f37f08912f277e1bfc5b19e5b21d74b4f9b4e0"
1662
+                "reference": "bbe1952f1b04e673ae86a6cac758979e5e3ed18c"
1663
             },
1663
             },
1664
             "dist": {
1664
             "dist": {
1665
                 "type": "zip",
1665
                 "type": "zip",
1666
-                "url": "https://api.github.com/repos/filamentphp/widgets/zipball/11f37f08912f277e1bfc5b19e5b21d74b4f9b4e0",
1667
-                "reference": "11f37f08912f277e1bfc5b19e5b21d74b4f9b4e0",
1666
+                "url": "https://api.github.com/repos/filamentphp/widgets/zipball/bbe1952f1b04e673ae86a6cac758979e5e3ed18c",
1667
+                "reference": "bbe1952f1b04e673ae86a6cac758979e5e3ed18c",
1668
                 "shasum": ""
1668
                 "shasum": ""
1669
             },
1669
             },
1670
             "require": {
1670
             "require": {
1695
                 "issues": "https://github.com/filamentphp/filament/issues",
1695
                 "issues": "https://github.com/filamentphp/filament/issues",
1696
                 "source": "https://github.com/filamentphp/filament"
1696
                 "source": "https://github.com/filamentphp/filament"
1697
             },
1697
             },
1698
-            "time": "2023-09-10T23:30:09+00:00"
1698
+            "time": "2023-09-18T10:30:45+00:00"
1699
         },
1699
         },
1700
         {
1700
         {
1701
             "name": "fruitcake/php-cors",
1701
             "name": "fruitcake/php-cors",
4750
         },
4750
         },
4751
         {
4751
         {
4752
             "name": "psy/psysh",
4752
             "name": "psy/psysh",
4753
-            "version": "v0.11.20",
4753
+            "version": "v0.11.21",
4754
             "source": {
4754
             "source": {
4755
                 "type": "git",
4755
                 "type": "git",
4756
                 "url": "https://github.com/bobthecow/psysh.git",
4756
                 "url": "https://github.com/bobthecow/psysh.git",
4757
-                "reference": "0fa27040553d1d280a67a4393194df5228afea5b"
4757
+                "reference": "bcb22101107f3bf770523b65630c9d547f60c540"
4758
             },
4758
             },
4759
             "dist": {
4759
             "dist": {
4760
                 "type": "zip",
4760
                 "type": "zip",
4761
-                "url": "https://api.github.com/repos/bobthecow/psysh/zipball/0fa27040553d1d280a67a4393194df5228afea5b",
4762
-                "reference": "0fa27040553d1d280a67a4393194df5228afea5b",
4761
+                "url": "https://api.github.com/repos/bobthecow/psysh/zipball/bcb22101107f3bf770523b65630c9d547f60c540",
4762
+                "reference": "bcb22101107f3bf770523b65630c9d547f60c540",
4763
                 "shasum": ""
4763
                 "shasum": ""
4764
             },
4764
             },
4765
             "require": {
4765
             "require": {
4789
             "extra": {
4789
             "extra": {
4790
                 "branch-alias": {
4790
                 "branch-alias": {
4791
                     "dev-main": "0.11.x-dev"
4791
                     "dev-main": "0.11.x-dev"
4792
+                },
4793
+                "bamarni-bin": {
4794
+                    "bin-links": false,
4795
+                    "forward-command": false
4792
                 }
4796
                 }
4793
             },
4797
             },
4794
             "autoload": {
4798
             "autoload": {
4820
             ],
4824
             ],
4821
             "support": {
4825
             "support": {
4822
                 "issues": "https://github.com/bobthecow/psysh/issues",
4826
                 "issues": "https://github.com/bobthecow/psysh/issues",
4823
-                "source": "https://github.com/bobthecow/psysh/tree/v0.11.20"
4827
+                "source": "https://github.com/bobthecow/psysh/tree/v0.11.21"
4824
             },
4828
             },
4825
-            "time": "2023-07-31T14:32:22+00:00"
4829
+            "time": "2023-09-17T21:15:54+00:00"
4826
         },
4830
         },
4827
         {
4831
         {
4828
             "name": "ralouphie/getallheaders",
4832
             "name": "ralouphie/getallheaders",
9738
         },
9742
         },
9739
         {
9743
         {
9740
             "name": "sebastian/exporter",
9744
             "name": "sebastian/exporter",
9741
-            "version": "5.0.1",
9745
+            "version": "5.1.0",
9742
             "source": {
9746
             "source": {
9743
                 "type": "git",
9747
                 "type": "git",
9744
                 "url": "https://github.com/sebastianbergmann/exporter.git",
9748
                 "url": "https://github.com/sebastianbergmann/exporter.git",
9745
-                "reference": "32ff03d078fed1279c4ec9a407d08c5e9febb480"
9749
+                "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344"
9746
             },
9750
             },
9747
             "dist": {
9751
             "dist": {
9748
                 "type": "zip",
9752
                 "type": "zip",
9749
-                "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/32ff03d078fed1279c4ec9a407d08c5e9febb480",
9750
-                "reference": "32ff03d078fed1279c4ec9a407d08c5e9febb480",
9753
+                "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c3fa8483f9539b190f7cd4bfc4a07631dd1df344",
9754
+                "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344",
9751
                 "shasum": ""
9755
                 "shasum": ""
9752
             },
9756
             },
9753
             "require": {
9757
             "require": {
9804
             "support": {
9808
             "support": {
9805
                 "issues": "https://github.com/sebastianbergmann/exporter/issues",
9809
                 "issues": "https://github.com/sebastianbergmann/exporter/issues",
9806
                 "security": "https://github.com/sebastianbergmann/exporter/security/policy",
9810
                 "security": "https://github.com/sebastianbergmann/exporter/security/policy",
9807
-                "source": "https://github.com/sebastianbergmann/exporter/tree/5.0.1"
9811
+                "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.0"
9808
             },
9812
             },
9809
             "funding": [
9813
             "funding": [
9810
                 {
9814
                 {
9812
                     "type": "github"
9816
                     "type": "github"
9813
                 }
9817
                 }
9814
             ],
9818
             ],
9815
-            "time": "2023-09-08T04:46:58+00:00"
9819
+            "time": "2023-09-18T07:15:37+00:00"
9816
         },
9820
         },
9817
         {
9821
         {
9818
             "name": "sebastian/global-state",
9822
             "name": "sebastian/global-state",
10657
         "php": "^8.2"
10661
         "php": "^8.2"
10658
     },
10662
     },
10659
     "platform-dev": [],
10663
     "platform-dev": [],
10660
-    "plugin-api-version": "2.6.0"
10664
+    "plugin-api-version": "2.3.0"
10661
 }
10665
 }

+ 1
- 1
config/services.php 查看文件

34
     'github' => [
34
     'github' => [
35
         'client_id' => env('GITHUB_CLIENT_ID'),
35
         'client_id' => env('GITHUB_CLIENT_ID'),
36
         'client_secret' => env('GITHUB_CLIENT_SECRET'),
36
         'client_secret' => env('GITHUB_CLIENT_SECRET'),
37
-        'redirect' => 'http://erpsaas2.test/company/oauth/github/callback',
37
+        'redirect' => 'http://erpsaas.test/company/oauth/github/callback',
38
     ],
38
     ],
39
 
39
 
40
 ];
40
 ];

+ 3
- 0
database/factories/Setting/CompanyProfileFactory.php 查看文件

3
 namespace Database\Factories\Setting;
3
 namespace Database\Factories\Setting;
4
 
4
 
5
 use App\Enums\EntityType;
5
 use App\Enums\EntityType;
6
+use App\Events\CompanyGenerated;
6
 use App\Models\Setting\CompanyProfile;
7
 use App\Models\Setting\CompanyProfile;
7
 use Illuminate\Database\Eloquent\Factories\Factory;
8
 use Illuminate\Database\Eloquent\Factories\Factory;
8
 
9
 
42
             $companyProfile->timezone = $this->faker->randomElement(CompanyProfile::getTimezoneOptions($companyProfile->country));
43
             $companyProfile->timezone = $this->faker->randomElement(CompanyProfile::getTimezoneOptions($companyProfile->country));
43
             $companyProfile->state = $this->faker->randomElement(CompanyProfile::getStateOptions($companyProfile->country));
44
             $companyProfile->state = $this->faker->randomElement(CompanyProfile::getStateOptions($companyProfile->country));
44
             $companyProfile->save();
45
             $companyProfile->save();
46
+
47
+            event(new CompanyGenerated($companyProfile->company->owner, $companyProfile->company, $companyProfile->country));
45
         });
48
         });
46
     }
49
     }
47
 }
50
 }

+ 20
- 0
database/factories/Setting/CurrencyFactory.php 查看文件

36
             'enabled' => true,
36
             'enabled' => true,
37
         ];
37
         ];
38
     }
38
     }
39
+
40
+    /**
41
+     * Define a state for a specific currency.
42
+     */
43
+    public function forCurrency(string $code): Factory
44
+    {
45
+        $currency = currency($code);
46
+
47
+        return $this->state([
48
+            'name' => $currency->getName(),
49
+            'code' => $currency->getCurrency(),
50
+            'rate' => $currency->getRate(),
51
+            'precision' => $currency->getPrecision(),
52
+            'symbol' => $currency->getSymbol(),
53
+            'symbol_first' => $currency->isSymbolFirst(),
54
+            'decimal_mark' => $currency->getDecimalMark(),
55
+            'thousands_separator' => $currency->getThousandsSeparator(),
56
+            'enabled' => true,
57
+        ]);
58
+    }
39
 }
59
 }

Loading…
取消
儲存