mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-30 04:23:11 +03:00
@ -3,6 +3,7 @@
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Oxbow\Activity;
|
||||
use Oxbow\Entity;
|
||||
use Session;
|
||||
|
||||
class ActivityService
|
||||
{
|
||||
@ -35,6 +36,7 @@ class ActivityService
|
||||
$this->activity->extra = $extra;
|
||||
}
|
||||
$entity->activity()->save($this->activity);
|
||||
$this->setNotification($activityKey);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,8 +54,10 @@ class ActivityService
|
||||
$this->activity->extra = $extra;
|
||||
}
|
||||
$this->activity->save();
|
||||
$this->setNotification($activityKey);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the entity attachment from each of its activities
|
||||
* and instead uses the 'extra' field with the entities name.
|
||||
@ -84,4 +88,17 @@ class ActivityService
|
||||
->skip($count*$page)->take($count)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Flashes a notification message to the session if an appropriate message is available.
|
||||
* @param $activityKey
|
||||
*/
|
||||
protected function setNotification($activityKey)
|
||||
{
|
||||
$notificationTextKey = 'activities.' . $activityKey . '_notification';
|
||||
if (trans()->has($notificationTextKey)) {
|
||||
$message = trans($notificationTextKey);
|
||||
Session::flash('success', $message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user