mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 18:20:48 +01:00
feat: make models sluggable
This commit is contained in:
@@ -2,12 +2,14 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Cviebrock\EloquentSluggable\Sluggable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SkinChroma extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use Sluggable;
|
||||
|
||||
protected $fillable = [
|
||||
'full_skin_id',
|
||||
@@ -21,6 +23,16 @@ class SkinChroma extends Model
|
||||
'chroma_colors' => 'array',
|
||||
];
|
||||
|
||||
public function sluggable(): array
|
||||
{
|
||||
$slug = $this->chroma_name . ' ' . $this->skin_name;
|
||||
return [
|
||||
'slug' => [
|
||||
'source' => $slug
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function skin()
|
||||
{
|
||||
return $this->belongsTo(Skin::class);
|
||||
|
||||
Reference in New Issue
Block a user