1. Go to this page and download the library: Download noud/laravel-seo-slug 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/ */
noud / laravel-seo-slug example snippets
namespace App\Models;
use Reliese\Database\Eloquent\Model as Eloquent;
use SEO\Models\Traits\Slug;
class BlogPosting extends Eloquent
{
use Slug;
private $url; // par exemple
public function generateSlug() {
// whatever logic you find appropriate
$urlParts = explode('/', $this->url);
end($urlParts);
return prev($urlParts);
}
}
class BlogPosting extends Eloquent
{
public function getRouteKeyName()
{
return 'sluggish';
}
}