CodeCommitAccess+1-at-632418466995 2 mēnešus atpakaļ
vecāks
revīzija
651be9654a
1 mainītis faili ar 3 papildinājumiem un 2 dzēšanām
  1. 3
    2
      app/Models/NewsParagraph.php

+ 3
- 2
app/Models/NewsParagraph.php Parādīt failu

@@ -47,8 +47,9 @@ class NewsParagraph extends Model
47 47
     protected function paragraphVideoType(): Attribute
48 48
     {
49 49
         return Attribute::make(
50
-            get: fn ($value) => ($this->paragraph_type == 3) ? ($this->attributes["video_type"] == 1 ? "url" : "upload") : null,
50
+            get: fn ($value) => ($this->paragraph_type == 3 && !is_null($this->video_type)) ? ($this->video_type == 1 ? "url" : "upload") : null,
51 51
         );
52
+
52 53
     }
53 54
     protected function paragraphVideoImg(): Attribute
54 55
     {
@@ -59,7 +60,7 @@ class NewsParagraph extends Model
59 60
     protected function paragraphVideoUrl(): Attribute
60 61
     {
61 62
         return Attribute::make(
62
-            get: fn ($value) => ($this->attributes["video_type"] == 2) ? Storage::disk('public')->url($this->attributes["video_url"]) : $this->attributes["link"],
63
+            get: fn ($value) => ($this->video_type == 2) ? Storage::disk('public')->url($this->video_url) : $this->attributes["link"],
63 64
         );
64 65
     }
65 66
 }