1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Added activity history to to all entities. Fixes #12

This commit is contained in:
Dan Brown
2015-08-16 18:59:23 +01:00
parent 41eb2fb633
commit 5d9d096028
19 changed files with 673 additions and 251 deletions

38
app/Activity.php Normal file
View File

@ -0,0 +1,38 @@
<?php
namespace Oxbow;
use Illuminate\Database\Eloquent\Model;
/**
* @property string key
* @property \User user
* @property \Entity entity
* @property string extra
*/
class Activity extends Model
{
public function entity()
{
if($this->entity_id) {
return $this->morphTo('entity')->first();
} else {
return false;
}
}
public function user()
{
return $this->belongsTo('Oxbow\User');
}
/**
* Returns text from the language files, Looks up by using the
* activity key.
*/
public function getText()
{
return trans('activities.' . $this->key);
}
}