]> BookStack Code Mirror - bookstack/blob - app/Activity.php
Updated views for permissions and added notifications. Fixes #2 and #7
[bookstack] / app / Activity.php
1 <?php
2
3 namespace Oxbow;
4
5 use Illuminate\Database\Eloquent\Model;
6
7 /**
8  * @property string key
9  * @property \User user
10  * @property \Entity entity
11  * @property string extra
12  */
13 class Activity extends Model
14 {
15     public function entity()
16     {
17         if($this->entity_id) {
18             return $this->morphTo('entity')->first();
19         } else {
20             return false;
21         }
22     }
23
24     public function user()
25     {
26         return $this->belongsTo('Oxbow\User');
27     }
28
29     /**
30      * Returns text from the language files, Looks up by using the
31      * activity key.
32      */
33     public function getText()
34     {
35         return trans('activities.' . $this->key);
36     }
37
38 }