lundi 18 janvier 2016

How to create a slug from title and subtitle in Laravel 5

I want to create a slug. it should be a concatenation of title and subtitle.The following is my code and it's not working, i don't know where i went wrong?

public function setTitleAttribute($value)
{
$this->attributes['main_title'] = ucfirst($value);
$this->attributes['sub_title'] = $value;
if (! $this->exists) {
  $this->attributes['slug'] = str_slug($this->attributes['main_title'].$this->attributes['sub_title']);
}
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire