feat: make models sluggable

This commit is contained in:
Rico van Zelst
2023-11-01 14:04:37 +01:00
parent 34f69de9fe
commit 69c072a003
3 changed files with 43 additions and 9 deletions

View File

@@ -2,12 +2,14 @@
namespace App\Models;
use Cviebrock\EloquentSluggable\Sluggable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ChampionSkin extends Model
{
use HasFactory;
use Sluggable;
protected $fillable = [
'champion_id',
@@ -36,6 +38,15 @@ class ChampionSkin extends Model
'splash_artist' => 'array',
];
public function sluggable(): array
{
return [
'slug' => [
'source' => 'skin_name'
]
];
}
public function champion()
{
return $this->belongsTo(Champion::class);