Exemplo n.º 1
0
 protected function preSave(Sport $sport)
 {
     $slugifier = new Slugify();
     // set slug
     if (Text::create($sport->getSlug())->isEmpty()) {
         $sport->setSlug($slugifier->slugify($sport->getTitle()));
     }
     // set object slug
     if (Text::create($sport->getObjectSlug())->isEmpty() && !Text::create($sport->getObjectLabel())->isEmpty()) {
         $sport->setObjectSlug($slugifier->slugify($sport->getObjectLabel()));
     }
     // set skill slug
     if (Text::create($sport->getSkillSlug())->isEmpty()) {
         $sport->setSkillSlug($slugifier->slugify($sport->getSkillLabel()));
     }
     // set group slug
     if (Text::create($sport->getGroupSlug())->isEmpty()) {
         $sport->setGroupSlug($slugifier->slugify($sport->getGroupLabel()));
     }
 }
Exemplo n.º 2
0
 /**
  * Returns the segment for the given sport
  * @param Sport $sport
  * @return string
  */
 public function getSportSegment(Sport $sport)
 {
     // TODO: Get slug in default locale
     return $sport->getSlug();
 }