2015-12-10 03:50:17 +08:00
|
|
|
<?php namespace BookStack;
|
|
|
|
|
2016-02-28 03:24:42 +08:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2015-12-10 03:50:17 +08:00
|
|
|
|
2016-02-28 03:24:42 +08:00
|
|
|
abstract class Ownable extends Model
|
2015-12-10 03:50:17 +08:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Relation for the user that created this entity.
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
*/
|
|
|
|
public function createdBy()
|
|
|
|
{
|
|
|
|
return $this->belongsTo('BookStack\User', 'created_by');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Relation for the user that updated this entity.
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
*/
|
|
|
|
public function updatedBy()
|
|
|
|
{
|
|
|
|
return $this->belongsTo('BookStack\User', 'updated_by');
|
|
|
|
}
|
2016-02-28 03:24:42 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the class name.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public static function getClassName()
|
|
|
|
{
|
|
|
|
return strtolower(array_slice(explode('\\', static::class), -1, 1)[0]);
|
|
|
|
}
|
|
|
|
|
2015-12-10 03:50:17 +08:00
|
|
|
}
|