]> BookStack Code Mirror - bookstack/blobdiff - app/Ownable.php
settings.php: add missing french translation
[bookstack] / app / Ownable.php
index d6505b7460440f95f1bf9e8eecd09ae6775129bd..f2cfe801b8a98e6e13349479c5834d16919be488 100644 (file)
@@ -1,7 +1,7 @@
 <?php namespace BookStack;
 
 
-trait Ownable
+abstract class Ownable extends Model
 {
     /**
      * Relation for the user that created this entity.
@@ -9,7 +9,7 @@ trait Ownable
      */
     public function createdBy()
     {
-        return $this->belongsTo('BookStack\User', 'created_by');
+        return $this->belongsTo(User::class, 'created_by');
     }
 
     /**
@@ -18,6 +18,16 @@ trait Ownable
      */
     public function updatedBy()
     {
-        return $this->belongsTo('BookStack\User', 'updated_by');
+        return $this->belongsTo(User::class, 'updated_by');
     }
+
+    /**
+     * Gets the class name.
+     * @return string
+     */
+    public static function getClassName()
+    {
+        return strtolower(array_slice(explode('\\', static::class), -1, 1)[0]);
+    }
+
 }
\ No newline at end of file