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