Andrew Wallo 4 ay önce
ebeveyn
işleme
bfafdeefd8
1 değiştirilmiş dosya ile 13 ekleme ve 0 silme
  1. 13
    0
      app/Models/Accounting/RecurringInvoice.php

+ 13
- 0
app/Models/Accounting/RecurringInvoice.php Dosyayı Görüntüle

@@ -33,10 +33,12 @@ use Filament\Notifications\Notification;
33 33
 use Guava\FilamentClusters\Forms\Cluster;
34 34
 use Illuminate\Database\Eloquent\Attributes\CollectedBy;
35 35
 use Illuminate\Database\Eloquent\Attributes\ObservedBy;
36
+use Illuminate\Database\Eloquent\Casts\Attribute;
36 37
 use Illuminate\Database\Eloquent\Model;
37 38
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
38 39
 use Illuminate\Database\Eloquent\Relations\HasMany;
39 40
 use Illuminate\Support\Carbon;
41
+use Illuminate\Support\Facades\Storage;
40 42
 use Livewire\Component;
41 43
 
42 44
 #[CollectedBy(DocumentCollection::class)]
@@ -113,6 +115,17 @@ class RecurringInvoice extends Document
113 115
         'total' => MoneyCast::class,
114 116
     ];
115 117
 
118
+    protected $appends = [
119
+        'logo_url',
120
+    ];
121
+
122
+    protected function logoUrl(): Attribute
123
+    {
124
+        return Attribute::get(static function (mixed $value, array $attributes): ?string {
125
+            return $attributes['logo'] ? Storage::disk('public')->url($attributes['logo']) : null;
126
+        });
127
+    }
128
+
116 129
     public function client(): BelongsTo
117 130
     {
118 131
         return $this->belongsTo(Client::class);

Loading…
İptal
Kaydet