/** * Generate a slug for the user. * * @param $username * @return string */ public function generateSlug($username) { $slug = \SlugGenerator::generateSlug($username); return $this->exists($slug) ? $slug . "-" . mt_rand(0, 10000) : $slug; }
/** * Generate a slug for the course. * * @param Course $course * @return string */ private function generateSlug(Course $course) { $slug = \SlugGenerator::generateSlug($course->title); return $this->exists($slug) ? $slug . "-" . $course->id : $slug; }