PHP code example of laraeast / laravel-sluggable
1. Go to this page and download the library: Download laraeast/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/ */
laraeast / laravel-sluggable example snippets
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
...
\Laraeast\LaravelSluggable\SluggableRedirectMiddleware::class,
],
...
];
use Laraeast\LaravelSluggable\Sluggable;
class Post extends Model
{
use Sluggable;
/**
* The sluggable fields for model.
*
* @return array
*/
public function sluggableFields()
{
return ['name'];
}
}