use BookStack\Entities\Models\Chapter;
use BookStack\Entities\Models\Entity;
use BookStack\Entities\Models\Page;
use BookStack\Entities\Models\Chapter;
use BookStack\Entities\Models\Entity;
use BookStack\Entities\Models\Page;
* @param string|Loggable $detail
*/
public function add(string $type, $detail = '')
* @param string|Loggable $detail
*/
public function add(string $type, $detail = '')
return $this->activity->newInstance()->forceFill([
'type' => strtolower($type),
return $this->activity->newInstance()->forceFill([
'type' => strtolower($type),
- 'user_id' => user()->id,
+ 'user_id' => user()->id,
+ 'ip' => config('app.env') === 'demo' ? '127.0.0.1' : $ip,
{
$entity->activity()->update([
'detail' => $entity->name,
{
$entity->activity()->update([
'detail' => $entity->name,
- if ($entity->isA('book')) {
- $queryIds[(new Chapter)->getMorphClass()] = $entity->chapters()->visible()->pluck('id');
+ if ($entity instanceof Book) {
+ $queryIds[(new Chapter())->getMorphClass()] = $entity->chapters()->visible()->pluck('id');
- if ($entity->isA('book') || $entity->isA('chapter')) {
- $queryIds[(new Page)->getMorphClass()] = $entity->pages()->visible()->pluck('id');
+ if ($entity instanceof Book || $entity instanceof Chapter) {
+ $queryIds[(new Page())->getMorphClass()] = $entity->pages()->visible()->pluck('id');