1. Go to this page and download the library: Download rayiumir/laravel-slugable 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/ */
rayiumir / laravel-slugable example snippets
class Post extends Model
{
use HasSlugable;
}
class Post extends Model
{
use HasSlugable;
protected $slugSourceField = 'name'; // Field to generate slug from
protected $slugDestinationField = 'slug'; // Field to store slug in
protected $slugUseForRoutes = false; // Use id for routes (default - no need to configure)
protected $slugUseForRoutes = true; // Use slug for routes
}
class Post extends Model
{
use HasSlugable;
protected $slugLanguage = 'fa'; // Supports 'fa', 'ar', 'en'
}
class Post extends Model
{
use HasSlugable;
protected $slugSeparator = '_'; // Default: '-'
protected $slugMaxLength = 100; // Default: 250
protected $slugForceUpdate = true; // Force regenerate on update
protected $slugShouldBeUnique = false; // Disable unique enforcement
}