]> BookStack Code Mirror - bookstack/blobdiff - app/File.php
Added initial translation into German (formal)
[bookstack] / app / File.php
index 055f217bd309efeb464bee8292a8df48a6fc28a6..e9b77d2ea192b4ddaafd7e3814b98d7ac6fa1b3c 100644 (file)
@@ -5,6 +5,16 @@ class File extends Ownable
 {
     protected $fillable = ['name', 'order'];
 
+    /**
+     * Get the downloadable file name for this upload.
+     * @return mixed|string
+     */
+    public function getFileName()
+    {
+        if (str_contains($this->name, '.')) return $this->name;
+        return $this->name . '.' . $this->extension;
+    }
+
     /**
      * Get the page this file was uploaded to.
      * @return Page
@@ -20,7 +30,7 @@ class File extends Ownable
      */
     public function getUrl()
     {
-        return '/files/' . $this->id;
+        return baseUrl('/files/' . $this->id);
     }
 
 }