10-04-2026
This commit is contained in:
parent
4d6b4930b2
commit
4bb89aad8c
836 changed files with 52961 additions and 5950 deletions
|
|
@ -0,0 +1,54 @@
|
|||
<?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::create('cabinet_tablet_settings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Store Status
|
||||
$table->enum('store_status', ['open', 'notice', 'closed'])->default('open');
|
||||
$table->string('notice_headline', 40)->nullable();
|
||||
$table->string('notice_subtext', 80)->nullable();
|
||||
|
||||
// Override opening hours for today (auto-reset at midnight)
|
||||
$table->string('override_open_today', 5)->nullable();
|
||||
$table->string('override_close_today', 5)->nullable();
|
||||
|
||||
// Next appointment
|
||||
$table->date('next_appointment_date')->nullable();
|
||||
$table->string('next_appointment_time', 5)->nullable();
|
||||
|
||||
// Standard opening hours per weekday
|
||||
$table->string('hours_monday', 30)->default('10:00 – 18:00');
|
||||
$table->string('hours_tuesday', 30)->default('10:00 – 18:00');
|
||||
$table->string('hours_wednesday', 30)->default('10:00 – 18:00');
|
||||
$table->string('hours_thursday', 30)->default('10:00 – 18:00');
|
||||
$table->string('hours_friday', 30)->default('10:00 – 18:00');
|
||||
$table->string('hours_saturday', 30)->default('10:00 – 14:00');
|
||||
$table->string('hours_sunday', 30)->default('Geschlossen');
|
||||
|
||||
// Contact
|
||||
$table->string('contact_phone', 50)->nullable();
|
||||
$table->string('contact_email', 100)->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cabinet_tablet_settings');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?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::create('display_versions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('type');
|
||||
$table->json('settings')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('display_versions');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?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::create('display_version_items', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('display_version_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('item_type');
|
||||
$table->json('content');
|
||||
$table->integer('sort_order')->default(0);
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('display_version_items');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?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::create('displays', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('location')->nullable();
|
||||
$table->foreignId('display_version_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('displays');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('display_display_version', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('display_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('display_version_id')->constrained()->cascadeOnDelete();
|
||||
$table->integer('sort_order')->default(0);
|
||||
});
|
||||
|
||||
// Migrate existing single-version assignments to pivot table
|
||||
$displays = DB::table('displays')->whereNotNull('display_version_id')->get();
|
||||
foreach ($displays as $display) {
|
||||
DB::table('display_display_version')->insert([
|
||||
'display_id' => $display->id,
|
||||
'display_version_id' => $display->display_version_id,
|
||||
'sort_order' => 0,
|
||||
]);
|
||||
}
|
||||
|
||||
Schema::table('displays', function (Blueprint $table) {
|
||||
$table->dropForeign(['display_version_id']);
|
||||
$table->dropColumn('display_version_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('displays', function (Blueprint $table) {
|
||||
$table->foreignId('display_version_id')->nullable()->constrained()->nullOnDelete();
|
||||
});
|
||||
|
||||
// Migrate first pivot entry back to single FK
|
||||
$pivots = DB::table('display_display_version')
|
||||
->orderBy('display_id')
|
||||
->orderBy('sort_order')
|
||||
->get()
|
||||
->groupBy('display_id');
|
||||
|
||||
foreach ($pivots as $displayId => $entries) {
|
||||
DB::table('displays')
|
||||
->where('id', $displayId)
|
||||
->update(['display_version_id' => $entries->first()->display_version_id]);
|
||||
}
|
||||
|
||||
Schema::dropIfExists('display_display_version');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
|
||||
|
||||
$permission = Permission::firstOrCreate(['name' => 'curate products', 'guard_name' => 'web']);
|
||||
|
||||
$adminRole = Role::where('name', 'Admin')->where('guard_name', 'web')->first();
|
||||
if ($adminRole && ! $adminRole->hasPermissionTo($permission)) {
|
||||
$adminRole->givePermissionTo($permission);
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
|
||||
|
||||
$permission = Permission::where('name', 'curate products')->where('guard_name', 'web')->first();
|
||||
|
||||
if ($permission) {
|
||||
$permission->roles()->detach();
|
||||
$permission->delete();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
private array $days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('cabinet_tablet_settings', function (Blueprint $table) {
|
||||
// Replace free-text store_status enum with a plain string so 'auto' is a valid value
|
||||
$table->string('store_status_new', 10)->default('auto')->after('id');
|
||||
});
|
||||
|
||||
// Migrate existing status values: 'open' → 'auto', keep 'notice'/'closed'
|
||||
DB::table('cabinet_tablet_settings')->update([
|
||||
'store_status_new' => DB::raw("CASE WHEN store_status = 'notice' THEN 'notice' WHEN store_status = 'closed' THEN 'closed' ELSE 'auto' END"),
|
||||
]);
|
||||
|
||||
Schema::table('cabinet_tablet_settings', function (Blueprint $table) {
|
||||
$table->dropColumn('store_status');
|
||||
});
|
||||
|
||||
Schema::table('cabinet_tablet_settings', function (Blueprint $table) {
|
||||
$table->renameColumn('store_status_new', 'store_status');
|
||||
});
|
||||
|
||||
// Add structured time columns for each weekday
|
||||
Schema::table('cabinet_tablet_settings', function (Blueprint $table) {
|
||||
foreach ($this->days as $day) {
|
||||
$table->string("hours_{$day}_open", 5)->nullable()->after("hours_{$day}");
|
||||
$table->string("hours_{$day}_close", 5)->nullable()->after("hours_{$day}_open");
|
||||
}
|
||||
});
|
||||
|
||||
// Migrate existing text values to structured columns (best-effort parse of "HH:MM – HH:MM")
|
||||
foreach (DB::table('cabinet_tablet_settings')->get() as $row) {
|
||||
$updates = [];
|
||||
foreach ($this->days as $day) {
|
||||
$text = $row->{"hours_{$day}"} ?? '';
|
||||
if (preg_match('/^(\d{2}:\d{2})\s*[–-]\s*(\d{2}:\d{2})$/', $text, $m)) {
|
||||
$updates["hours_{$day}_open"] = $m[1];
|
||||
$updates["hours_{$day}_close"] = $m[2];
|
||||
}
|
||||
// If "Geschlossen" or no match: both remain null (closed)
|
||||
}
|
||||
if ($updates) {
|
||||
DB::table('cabinet_tablet_settings')->where('id', $row->id)->update($updates);
|
||||
}
|
||||
}
|
||||
|
||||
// Drop old free-text hour columns
|
||||
Schema::table('cabinet_tablet_settings', function (Blueprint $table) {
|
||||
$table->dropColumn(array_map(fn ($d) => "hours_{$d}", $this->days));
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('cabinet_tablet_settings', function (Blueprint $table) {
|
||||
// Restore free-text columns
|
||||
foreach (array_reverse($this->days) as $day) {
|
||||
$table->string("hours_{$day}", 30)->default('Geschlossen')->after('next_appointment_time');
|
||||
}
|
||||
});
|
||||
|
||||
// Reconstruct display strings
|
||||
foreach (DB::table('cabinet_tablet_settings')->get() as $row) {
|
||||
$updates = [];
|
||||
foreach ($this->days as $day) {
|
||||
$open = $row->{"hours_{$day}_open"};
|
||||
$close = $row->{"hours_{$day}_close"};
|
||||
$updates["hours_{$day}"] = ($open && $close) ? "{$open} – {$close}" : 'Geschlossen';
|
||||
}
|
||||
DB::table('cabinet_tablet_settings')->where('id', $row->id)->update($updates);
|
||||
}
|
||||
|
||||
Schema::table('cabinet_tablet_settings', function (Blueprint $table) {
|
||||
$columns = [];
|
||||
foreach ($this->days as $day) {
|
||||
$columns[] = "hours_{$day}_open";
|
||||
$columns[] = "hours_{$day}_close";
|
||||
}
|
||||
$table->dropColumn($columns);
|
||||
|
||||
// Restore enum column
|
||||
$table->string('store_status_old', 10)->default('open')->after('id');
|
||||
});
|
||||
|
||||
DB::table('cabinet_tablet_settings')->update([
|
||||
'store_status_old' => DB::raw("CASE WHEN store_status = 'notice' THEN 'notice' WHEN store_status = 'closed' THEN 'closed' ELSE 'open' END"),
|
||||
]);
|
||||
|
||||
Schema::table('cabinet_tablet_settings', function (Blueprint $table) {
|
||||
$table->dropColumn('store_status');
|
||||
});
|
||||
|
||||
Schema::table('cabinet_tablet_settings', function (Blueprint $table) {
|
||||
$table->renameColumn('store_status_old', 'store_status');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?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('cms_projects', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('slug')->unique();
|
||||
$table->json('title');
|
||||
$table->json('location')->nullable();
|
||||
$table->string('status')->nullable();
|
||||
$table->date('launch_date')->nullable();
|
||||
$table->unsignedInteger('price_from_aed')->nullable();
|
||||
$table->string('currency')->default('AED');
|
||||
$table->string('image')->nullable();
|
||||
$table->json('highlights')->nullable();
|
||||
$table->json('quick_facts')->nullable();
|
||||
$table->json('investment_case')->nullable();
|
||||
$table->json('gallery')->nullable();
|
||||
$table->json('location_info')->nullable();
|
||||
$table->json('contact')->nullable();
|
||||
$table->boolean('is_published')->default(false);
|
||||
$table->unsignedInteger('order')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cms_projects');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?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('cms_articles', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('slug')->unique();
|
||||
$table->json('title');
|
||||
$table->json('subtitle')->nullable();
|
||||
$table->string('image')->nullable();
|
||||
$table->string('category')->nullable();
|
||||
$table->string('date_label')->nullable();
|
||||
$table->string('read_time')->nullable();
|
||||
$table->json('author')->nullable();
|
||||
$table->json('content')->nullable();
|
||||
$table->boolean('is_published')->default(true);
|
||||
$table->integer('order')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cms_articles');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?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('cms_projects', function (Blueprint $table) {
|
||||
$table->json('investor_trust')->nullable()->after('contact');
|
||||
$table->json('furniture_benefit')->nullable()->after('investor_trust');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('cms_projects', function (Blueprint $table) {
|
||||
$table->dropColumn(['investor_trust', 'furniture_benefit']);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?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::create('display_media', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('filename');
|
||||
$table->string('disk')->default('public');
|
||||
$table->string('path')->nullable();
|
||||
$table->string('external_url', 2048)->nullable();
|
||||
$table->string('source_type')->default('upload');
|
||||
$table->string('type')->default('image');
|
||||
$table->string('mime_type')->nullable();
|
||||
$table->unsignedBigInteger('file_size')->default(0);
|
||||
$table->string('thumbnail_path')->nullable();
|
||||
$table->string('alt_text')->nullable();
|
||||
$table->string('title')->nullable();
|
||||
$table->string('collection')->nullable()->index();
|
||||
$table->json('metadata')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['type', 'collection']);
|
||||
$table->index('source_type');
|
||||
$table->index('is_active');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('display_media');
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue