feat: add theme
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('themes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('key')->unique(); // blue, pink, green, orange, purple
|
||||
$table->string('name'); // display label
|
||||
$table->json('colors'); // full color map (json works on MySQL & Postgres)
|
||||
$table->integer('order')->default(0);
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('themes');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('scenes', function (Blueprint $table) {
|
||||
$table->foreignId('theme_id')->nullable()->after('id')
|
||||
->constrained('themes')->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('scenes', function (Blueprint $table) {
|
||||
$table->dropForeign(['theme_id']);
|
||||
$table->dropColumn('theme_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Theme;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ThemeSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$common = [
|
||||
'bgPrimary' => '#26000000',
|
||||
'bgSecondary' => '#33000000',
|
||||
'bgTertiary' => '#40000000',
|
||||
'bgFourth' => '#80000000',
|
||||
'bgBlack' => '#99000000',
|
||||
'bgWhite' => '#FFF7F7F7',
|
||||
'bgError' => '#FFF04438',
|
||||
'fgPrimary' => '#FFFFFFFF',
|
||||
'fgSecondary' => '#FFD9D9D9',
|
||||
'fgDisable' => '#FFC0C0C0',
|
||||
'fgBlack' => '#FF000000',
|
||||
'fgBlack2' => '#FF2F2F2F',
|
||||
'fgError' => '#FFF04438',
|
||||
'textPrimary' => '#FFFFFFFF',
|
||||
'textSecondary' => '#FFD9D9D9',
|
||||
'textDisable' => '#FFC0C0C0',
|
||||
'textPrimaryReverse' => '#FF000000',
|
||||
'textPrimaryReverse2' => '#FF2F2F2F',
|
||||
'textError' => '#FFF04438',
|
||||
'borderPrimary' => '#26FFFFFF',
|
||||
'borderSecondary' => '#40FFFFFF',
|
||||
'borderWhite' => '#FFFFFFFF',
|
||||
'borderBlack' => '#FF000000',
|
||||
'borderError' => '#FFF04438',
|
||||
];
|
||||
|
||||
$themes = [
|
||||
[
|
||||
'key' => 'blue',
|
||||
'name' => 'آبی',
|
||||
'order' => 1,
|
||||
'colors' => array_merge($common, [
|
||||
'themeUp' => '#156395',
|
||||
'themeDown' => '#2E3381',
|
||||
'bottomNavigation' => '#292E74',
|
||||
'lightColorGradient' => '#3ABDEB',
|
||||
'darkColorGradient' => '#553AEB',
|
||||
'chatContainer' => '#252967',
|
||||
'bottomPlayerContainer' => '#252967',
|
||||
'bgBrand' => '#5360FC',
|
||||
'fgBrand' => '#5360FC',
|
||||
'textBrand' => '#5360FC',
|
||||
'borderBrand' => '#5360FC',
|
||||
]),
|
||||
],
|
||||
[
|
||||
'key' => 'pink',
|
||||
'name' => 'صورتی',
|
||||
'order' => 2,
|
||||
'colors' => array_merge($common, [
|
||||
'themeUp' => '#843F6A',
|
||||
'themeDown' => '#4F366F',
|
||||
'bottomNavigation' => '#3F2B59',
|
||||
'lightColorGradient' => '#CE4299',
|
||||
'darkColorGradient' => '#8628FF',
|
||||
'chatContainer' => '#3F2B59',
|
||||
'bottomPlayerContainer' => '#3F2B59',
|
||||
'bgBrand' => '#843F6A',
|
||||
'fgBrand' => '#843F6A',
|
||||
'textBrand' => '#FFFF80AB',
|
||||
'borderBrand' => '#843F6A',
|
||||
]),
|
||||
],
|
||||
[
|
||||
'key' => 'green',
|
||||
'name' => 'سبز',
|
||||
'order' => 3,
|
||||
'colors' => array_merge($common, [
|
||||
'themeUp' => '#3B6D3B',
|
||||
'themeDown' => '#064A3F',
|
||||
'bottomNavigation' => '#054339',
|
||||
'lightColorGradient' => '#5CC65C',
|
||||
'darkColorGradient' => '#00A489',
|
||||
'chatContainer' => '#053B32',
|
||||
'bottomPlayerContainer' => '#053B32',
|
||||
'bgBrand' => '#3B6D3B',
|
||||
'fgBrand' => '#3B6D3B',
|
||||
'textBrand' => '#4CAF50',
|
||||
'borderBrand' => '#3B6D3B',
|
||||
]),
|
||||
],
|
||||
[
|
||||
'key' => 'orange',
|
||||
'name' => 'نارنجی',
|
||||
'order' => 4,
|
||||
'colors' => array_merge($common, [
|
||||
'themeUp' => '#7E5607',
|
||||
'themeDown' => '#81381D',
|
||||
'bottomNavigation' => '#74321A',
|
||||
'lightColorGradient' => '#E2990A',
|
||||
'darkColorGradient' => '#CC4B1C',
|
||||
'chatContainer' => '#672D17',
|
||||
'bottomPlayerContainer' => '#672D17',
|
||||
'bgBrand' => '#7E5607',
|
||||
'fgBrand' => '#7E5607',
|
||||
'textBrand' => '#FFE2990A',
|
||||
'borderBrand' => '#7E5607',
|
||||
]),
|
||||
],
|
||||
[
|
||||
'key' => 'purple',
|
||||
'name' => 'بنفش',
|
||||
'order' => 5,
|
||||
'colors' => array_merge($common, [
|
||||
'themeUp' => '#371F63',
|
||||
'themeDown' => '#132F6F',
|
||||
'bottomNavigation' => '#112A64',
|
||||
'lightColorGradient' => '#6829DD',
|
||||
'darkColorGradient' => '#1A50CC',
|
||||
'chatContainer' => '#0F2659',
|
||||
'bottomPlayerContainer' => '#0F2659',
|
||||
'bgBrand' => '#371F63',
|
||||
'fgBrand' => '#371F63',
|
||||
'textBrand' => '#1A50CC',
|
||||
'borderBrand' => '#371F63',
|
||||
]),
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($themes as $theme) {
|
||||
Theme::updateOrCreate(['key' => $theme['key']], $theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user