feat: add slug to all tables

This commit is contained in:
Rico van Zelst
2023-11-02 11:10:15 +01:00
parent 1c18904253
commit 87280627ee
4 changed files with 86 additions and 3 deletions

View File

@@ -25,11 +25,10 @@ class SkinChroma extends Model
public function sluggable(): array
{
$slug = $this->chroma_name.' '.$this->skin_name;
// chroma name + skin name
return [
'slug' => [
'source' => $slug,
'source' => ['chroma_name', 'skin_name'],
],
];
}

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('champions', function (Blueprint $table) {
$table->string('slug')->after('release_patch')->unique()->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('champions', function (Blueprint $table) {
$table->dropColumn('slug');
});
}
};

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('champion_skins', function (Blueprint $table) {
$table->string('slug')->after('splash_artist')->unique()->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('champion_skins', function (Blueprint $table) {
$table->dropColumn('slug');
});
}
};

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('skin_chromas', function (Blueprint $table) {
$table->string('slug')->after('chroma_image')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('skin_chromas', function (Blueprint $table) {
$table->dropColumn('slug');
});
}
};