Andrew Wallo před 6 měsíci
rodič
revize
5ba22880f5

+ 14
- 6
app/Filament/Company/Resources/Sales/InvoiceResource.php Zobrazit soubor

@@ -440,9 +440,13 @@ class InvoiceResource extends Resource
440 440
                                 Forms\Components\Select::make('bank_account_id')
441 441
                                     ->label('Account')
442 442
                                     ->required()
443
-                                    ->options(BankAccount::query()
444
-                                        ->get()
445
-                                        ->pluck('account.name', 'id'))
443
+                                    ->options(function () {
444
+                                        return BankAccount::query()
445
+                                            ->join('accounts', 'bank_accounts.account_id', '=', 'accounts.id')
446
+                                            ->select(['bank_accounts.id', 'accounts.name'])
447
+                                            ->pluck('accounts.name', 'bank_accounts.id')
448
+                                            ->toArray();
449
+                                    })
446 450
                                     ->searchable(),
447 451
                                 Forms\Components\Textarea::make('notes')
448 452
                                     ->label('Notes'),
@@ -606,9 +610,13 @@ class InvoiceResource extends Resource
606 610
                             Forms\Components\Select::make('bank_account_id')
607 611
                                 ->label('Account')
608 612
                                 ->required()
609
-                                ->options(BankAccount::query()
610
-                                    ->get()
611
-                                    ->pluck('account.name', 'id'))
613
+                                ->options(function () {
614
+                                    return BankAccount::query()
615
+                                        ->join('accounts', 'bank_accounts.account_id', '=', 'accounts.id')
616
+                                        ->select(['bank_accounts.id', 'accounts.name'])
617
+                                        ->pluck('accounts.name', 'bank_accounts.id')
618
+                                        ->toArray();
619
+                                })
612 620
                                 ->searchable(),
613 621
                             Forms\Components\Textarea::make('notes')
614 622
                                 ->label('Notes'),

+ 5
- 5
app/Policies/EstimatePolicy.php Zobrazit soubor

@@ -20,7 +20,7 @@ class EstimatePolicy
20 20
      */
21 21
     public function view(User $user, Estimate $estimate): bool
22 22
     {
23
-        return $user->belongsToCompany($estimate->company);
23
+        return true;
24 24
     }
25 25
 
26 26
     /**
@@ -40,7 +40,7 @@ class EstimatePolicy
40 40
             return false;
41 41
         }
42 42
 
43
-        return $user->belongsToCompany($estimate->company);
43
+        return true;
44 44
     }
45 45
 
46 46
     /**
@@ -48,7 +48,7 @@ class EstimatePolicy
48 48
      */
49 49
     public function delete(User $user, Estimate $estimate): bool
50 50
     {
51
-        return $user->belongsToCompany($estimate->company);
51
+        return true;
52 52
     }
53 53
 
54 54
     /**
@@ -56,7 +56,7 @@ class EstimatePolicy
56 56
      */
57 57
     public function restore(User $user, Estimate $estimate): bool
58 58
     {
59
-        return $user->belongsToCompany($estimate->company);
59
+        return true;
60 60
     }
61 61
 
62 62
     /**
@@ -64,6 +64,6 @@ class EstimatePolicy
64 64
      */
65 65
     public function forceDelete(User $user, Estimate $estimate): bool
66 66
     {
67
-        return $user->belongsToCompany($estimate->company);
67
+        return true;
68 68
     }
69 69
 }

Načítá se…
Zrušit
Uložit