1. Go to this page and download the library: Download arniro/laravel-sluggable 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/ */
arniro / laravel-sluggable example snippets
use Arniro\Sluggable\Sluggable;
use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
use Sluggable;
//
}
Product::create([
'name' => 'Lorem Ipsum'
]);
use Arniro\Sluggable\Sluggable;
use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
use Sluggable;
public function getSluggable()
{
return 'title';
}
//
}
use Arniro\Sluggable\Sluggable;
use Illuminate\Database\Eloquent\Model;
use Spatie\Translatable\HasTranslations;
class Product extends Model
{
use HasTranslations, Sluggable;
public $translatable = ['name', 'slug'];
//
}