SHARE
TWEET

Untitled

a guest Sep 17th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function makeSlugFromTitle($title)
  2. {
  3.     $slug = Str::slug($title);
  4.  
  5.     $count = Conversation::whereRaw("slug RLIKE '^{$slug}(-[0-9]+)?$'")->count();
  6.  
  7.     return $count ? "{$slug}-{$count}" : $slug;
  8. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top