Skip to content

Commit

Permalink
Merge pull request #7 from larapack/develop
Browse files Browse the repository at this point in the history
Merge from develop
  • Loading branch information
marktopper committed Dec 9, 2015
2 parents 214c852 + 1d859d8 commit e390fc5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ First add the trait `Sluggable` to your Eloquent Model.
namespace App;
use Larapack/AttributeSlugging/Sluggable;
use Larapack\AttributeSlugging\Sluggable;
class User
{
Expand Down
2 changes: 1 addition & 1 deletion src/Larapack/AttributeSlugging/Sluggable.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected function getSluggableUniqueAttributeValue($name, $value)
$separator = $this->getSluggableSeparator();

// Remove any existing suffixes
$_value = preg_replace('/'.preg_quote($separator).'[0-9]+$/', '', trim($value));
$_value = preg_replace('/'.preg_quote($separator).'+$/', '', trim($value));

// If this model already have a slug that matches the requirements, then return that slug
$current = $this->newQuery()->whereRaw("{$name} RLIKE '{$_value}(-[0-9]*)?$'")->where($keyName, $keyValue)->first();
Expand Down

0 comments on commit e390fc5

Please sign in to comment.