-
composer.json
Open in GitHub{ "require": { "php": "^7.3", // "cviebrock/eloquent-sluggable": "^8" }, }
-
app/User.php
Open in GitHubuse Cviebrock\EloquentSluggable\Sluggable; use Illuminate\Foundation\Auth\User as Authenticatable; use \Cviebrock\EloquentSluggable\Services\SlugService; class User extends Authenticatable { use Sluggable; public function getRouteKeyName() { return 'username'; } public function sluggable() { return [ 'username' => [ 'unique' => true, 'source' => 'name', 'reserved' => ['my'], ], ]; } }