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