Skip to content

Commit

Permalink
add slugWithKey method
Browse files Browse the repository at this point in the history
  • Loading branch information
MoamenEltouny committed Feb 15, 2022
1 parent e370a63 commit e22a909
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Sluggable.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ protected static function bootSluggable()
});
}

/**
* Getting slug with the key.
*
* @return string
*/
public function getSlugWithKeyAttribute()
{
return implode('-', [$this->getKey(), $this->slug]);
}

/**
* Generate slug for specific record.
*
Expand Down

0 comments on commit e22a909

Please sign in to comment.