1. Go to this page and download the library: Download zymawy/arabify library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
class YourEloquentModel extends Model
{
use HasSlug;
/**
* This function is optional and only return SlugOptions::create()
->slugSeperator('-')
->generateSlugFrom('name')
->saveSlugTo('slug');
}
}
class YourEloquentModel extends Model
{
use HasSlug;
public function getNameAndFooAttribute()
{
$name = $this->name;
if ($this->foo) {
$name .= " {$this->foo->name}";
}
return $name;
}
protected function getSlugOptions()
{
return SlugOptions::create()
->generateSlugFrom('name_and_foo');
}
}