mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-30 15:42:41 +01:00
34 lines
802 B
PHP
34 lines
802 B
PHP
<?php namespace BookStack;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
abstract class Ownable extends Model
|
|
{
|
|
/**
|
|
* 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');
|
|
}
|
|
|
|
/**
|
|
* Gets the class name.
|
|
* @return string
|
|
*/
|
|
public static function getClassName()
|
|
{
|
|
return strtolower(array_slice(explode('\\', static::class), -1, 1)[0]);
|
|
}
|
|
|
|
} |