]> BookStack Code Mirror - bookstack/blob - app/Ownable.php
Added basic system tests for markdown editor, Added extra test helpers
[bookstack] / app / Ownable.php
1 <?php namespace BookStack;
2
3 use Illuminate\Database\Eloquent\Model;
4
5 abstract class Ownable extends Model
6 {
7     /**
8      * Relation for the user that created this entity.
9      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
10      */
11     public function createdBy()
12     {
13         return $this->belongsTo('BookStack\User', 'created_by');
14     }
15
16     /**
17      * Relation for the user that updated this entity.
18      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
19      */
20     public function updatedBy()
21     {
22         return $this->belongsTo('BookStack\User', 'updated_by');
23     }
24
25     /**
26      * Gets the class name.
27      * @return string
28      */
29     public static function getClassName()
30     {
31         return strtolower(array_slice(explode('\\', static::class), -1, 1)[0]);
32     }
33
34 }