Added tags to page display and simplified editing flow

Tags now save with the page content data
This commit is contained in:
Dan Brown
2016-05-15 10:39:17 +01:00
parent 78564ec61d
commit 7932069535
6 changed files with 200 additions and 144 deletions

View File

@ -14,14 +14,17 @@ class PageRepo extends EntityRepo
{
protected $pageRevision;
protected $tagRepo;
/**
* PageRepo constructor.
* @param PageRevision $pageRevision
* @param TagRepo $tagRepo
*/
public function __construct(PageRevision $pageRevision)
public function __construct(PageRevision $pageRevision, TagRepo $tagRepo)
{
$this->pageRevision = $pageRevision;
$this->tagRepo = $tagRepo;
parent::__construct();
}
@ -308,6 +311,11 @@ class PageRepo extends EntityRepo
$page->slug = $this->findSuitableSlug($input['name'], $book_id, $page->id);
}
// Save page tags if present
if(isset($input['tags'])) {
$this->tagRepo->saveTagsToEntity($page, $input['tags']);
}
// Update with new details
$userId = auth()->user()->id;
$page->fill($input);