Hey, @lordfarhan
You can simply use Str::slug('name')
in your component.
Or if you want to make slug created automatically when filling your model info use observer.
In your model
...
use Illuminate\Support\Str;
...
proteced static function boot()
{
parent::boot();
self::saving(function ($model) {
$model->slug = Str::slug($model->name);
});
}
If you want to show the mealtime slug when the user type (e.g: name field):
$this->name;
$this->slug;
public function updatedName($field)
{
$this->slug = Str::slug($field);
}
In your blade
<input type"text" wire:model="name"/>
<input type="text" wire:model="slug"/>
PS: You can do both at the same time and this up to you.