mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-17 09:52:27 +08:00
Organised activity types and moved most to repos
Repos are generally better since otherwise we end up duplicating things between front-end and API. Types moved to by CONST values within a class for better visibilty of usage and listing of types.
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
<?php namespace BookStack\Http\Controllers;
|
||||
|
||||
use Activity;
|
||||
use BookStack\Entities\Book;
|
||||
use BookStack\Entities\Managers\BookContents;
|
||||
use BookStack\Entities\Repos\ChapterRepo;
|
||||
@ -51,7 +50,6 @@ class ChapterController extends Controller
|
||||
$this->checkOwnablePermission('chapter-create', $book);
|
||||
|
||||
$chapter = $this->chapterRepo->create($request->all(), $book);
|
||||
Activity::add($chapter, 'chapter_create', $book->id);
|
||||
|
||||
return redirect($chapter->getUrl());
|
||||
}
|
||||
@ -100,7 +98,6 @@ class ChapterController extends Controller
|
||||
$this->checkOwnablePermission('chapter-update', $chapter);
|
||||
|
||||
$this->chapterRepo->update($chapter, $request->all());
|
||||
Activity::add($chapter, 'chapter_update', $chapter->book->id);
|
||||
|
||||
return redirect($chapter->getUrl());
|
||||
}
|
||||
@ -128,7 +125,6 @@ class ChapterController extends Controller
|
||||
$chapter = $this->chapterRepo->getBySlug($bookSlug, $chapterSlug);
|
||||
$this->checkOwnablePermission('chapter-delete', $chapter);
|
||||
|
||||
Activity::add($chapter, 'chapter_delete', $chapter->book->id);
|
||||
$this->chapterRepo->destroy($chapter);
|
||||
|
||||
return redirect($chapter->book->getUrl());
|
||||
@ -173,8 +169,6 @@ class ChapterController extends Controller
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
Activity::add($chapter, 'chapter_move', $newBook->id);
|
||||
|
||||
$this->showSuccessNotification(trans('entities.chapter_move_success', ['bookName' => $newBook->name]));
|
||||
return redirect($chapter->getUrl());
|
||||
}
|
||||
|
Reference in New Issue
Block a user