public function getInitial()
{
$words = new Collection(explode(' ', $this->name));
// if name contains single word, use first N character
if ($words->count() === 1) {
if ($this->name->length() >= $this->length) {
return $this->name->substr(0, $this->length);
}
return (string) $words->first();
}
// otherwise, use initial char from each word
$initials = new Collection();
$words->each(function ($word) use($initials) {
$initials->push(Stringy::create($word)->substr(0, 1));
});
return $initials->slice(0, $this->length)->implode('');
}