<?php namespace BookStack;
-trait Ownable
+abstract class Ownable extends Model
{
/**
* Relation for the user that created this entity.
*/
public function createdBy()
{
- return $this->belongsTo('BookStack\User', 'created_by');
+ return $this->belongsTo(User::class, 'created_by');
}
/**
*/
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