From 45e3e518df5aaea618468eea8f2476fadc7c3f09 Mon Sep 17 00:00:00 2001
From: Ash Monsh
Date: Sun, 21 May 2023 02:37:47 +0300
Subject: [PATCH 1/2] add theFile function
check if the file is uploaded or from a URL
---
.../views/themes/zeus/addons/library-item.blade.php | 7 +++----
src/Models/Library.php | 9 +++++++++
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/resources/views/themes/zeus/addons/library-item.blade.php b/resources/views/themes/zeus/addons/library-item.blade.php
index fe3ed24..713cf48 100644
--- a/resources/views/themes/zeus/addons/library-item.blade.php
+++ b/resources/views/themes/zeus/addons/library-item.blade.php
@@ -28,12 +28,12 @@
@if($item->type === 'IMAGE')
-
+
@endif
@if($item->type === 'FILE')
-
+
{{ __('Show File') }}
@@ -41,10 +41,9 @@
@if($item->type === 'VIDEO')
@endif
-
diff --git a/src/Models/Library.php b/src/Models/Library.php
index b828116..05ba151 100644
--- a/src/Models/Library.php
+++ b/src/Models/Library.php
@@ -47,4 +47,13 @@ public function getRouteKeyName()
{
return 'slug';
}
+
+ public function theFile()
+ {
+ if (!$this->getMedia('library')->isEmpty()) {
+ return $this->getFirstMediaUrl('library');
+ }
+
+ return $this->file_path;
+ }
}
From da670875d6f1bf706d8fa2fdec9e8f70c496eb7b Mon Sep 17 00:00:00 2001
From: atmonshi
Date: Sat, 20 May 2023 23:38:16 +0000
Subject: [PATCH 2/2] Fix styling
---
src/Models/Library.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Models/Library.php b/src/Models/Library.php
index 05ba151..31b6a8e 100644
--- a/src/Models/Library.php
+++ b/src/Models/Library.php
@@ -50,7 +50,7 @@ public function getRouteKeyName()
public function theFile()
{
- if (!$this->getMedia('library')->isEmpty()) {
+ if (! $this->getMedia('library')->isEmpty()) {
return $this->getFirstMediaUrl('library');
}