padre
commit
651be9654a
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3
    2
      app/Models/NewsParagraph.php

+ 3
- 2
app/Models/NewsParagraph.php Ver fichero

47
     protected function paragraphVideoType(): Attribute
47
     protected function paragraphVideoType(): Attribute
48
     {
48
     {
49
         return Attribute::make(
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
     protected function paragraphVideoImg(): Attribute
54
     protected function paragraphVideoImg(): Attribute
54
     {
55
     {
59
     protected function paragraphVideoUrl(): Attribute
60
     protected function paragraphVideoUrl(): Attribute
60
     {
61
     {
61
         return Attribute::make(
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
 }