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:
38
app/Activity.php
Normal file
38
app/Activity.php
Normal 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);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user