Skip to content

Commit

Permalink
Improve the Content module
Browse files Browse the repository at this point in the history
  • Loading branch information
LuckyCyborg committed Jul 17, 2019
1 parent acba772 commit eb5e756
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions modules/Content/Controllers/Admin/Posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,16 +371,20 @@ public function update(Request $request, $id)
}

// Create a new revision from the current Post instance.
$count = 1;
$count = 0;

$names = $post->revision()->lists('name');

foreach ($names as $name) {
if (preg_match('#^(?:\d+)-revision-v(\d+)$#', $name, $matches) === 1) {
$count = max($count, 1 + (int) $matches[1]);
if (preg_match('#^(?:\d+)-revision-v(\d+)$#', $name, $matches) !== 1) {
continue;
}

$count = max($count, (int) $matches[1]);
}

$count++;

$slug = $post->id .'-revision-v' .$count;

$revision = Post::create(array(
Expand Down

0 comments on commit eb5e756

Please sign in to comment.