New Initial Commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?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('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,57 @@
|
||||
<?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('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -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('categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('slug')->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->string('image')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('categories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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('products', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('category_id')->nullable();
|
||||
$table->string('name');
|
||||
$table->string('slug')->unique();
|
||||
$table->text('description');
|
||||
$table->decimal('price', 10, 2);
|
||||
$table->string('image')->nullable();
|
||||
$table->integer('stock')->default(0);
|
||||
$table->boolean('featured')->default(false);
|
||||
$table->timestamps();
|
||||
$table->foreign('category_id')->references('id')->on('categories')->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('products');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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('orders', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('user_id')->nullable();
|
||||
$table->string('order_number')->unique();
|
||||
$table->decimal('total', 12, 2);
|
||||
$table->string('status')->default('pending');
|
||||
$table->string('payment_method')->nullable();
|
||||
$table->string('payment_status')->default('unpaid');
|
||||
$table->text('shipping_address')->nullable();
|
||||
$table->timestamps();
|
||||
$table->foreign('user_id')->references('id')->on('users')->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('orders');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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('order_items', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('order_id');
|
||||
$table->unsignedBigInteger('product_id');
|
||||
$table->integer('quantity');
|
||||
$table->decimal('price', 10, 2);
|
||||
$table->timestamps();
|
||||
$table->foreign('order_id')->references('id')->on('orders')->cascadeOnDelete();
|
||||
$table->foreign('product_id')->references('id')->on('products')->cascadeOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('order_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::table('order_items', function (Blueprint $table) {
|
||||
$table->string('type')->default('wallpaper')->after('price');
|
||||
$table->decimal('length', 8, 2)->nullable()->after('type');
|
||||
$table->decimal('width', 8, 2)->nullable()->after('length');
|
||||
$table->decimal('height', 8, 2)->nullable()->after('width');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->dropColumn(['type', 'length', 'width', 'height']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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::table('orders', function (Blueprint $table) {
|
||||
$table->string('customer_name')->after('user_id');
|
||||
$table->string('customer_email')->after('customer_name');
|
||||
$table->string('customer_phone')->after('customer_email');
|
||||
$table->text('notes')->nullable()->after('shipping_address');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->dropColumn(['customer_name', 'customer_email', 'customer_phone', 'notes']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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('print_stocks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->text('description')->nullable();
|
||||
$table->decimal('cost_per_meter', 10, 2)->nullable();
|
||||
$table->decimal('cost_per_m2', 10, 2)->nullable();
|
||||
$table->enum('type', ['wallpaper', 'mural', 'both'])->default('both');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('print_stocks');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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('product_print_stocks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('product_id');
|
||||
$table->unsignedBigInteger('print_stock_id');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
|
||||
$table->foreign('print_stock_id')->references('id')->on('print_stocks')->onDelete('cascade');
|
||||
$table->unique(['product_id', 'print_stock_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('product_print_stocks');
|
||||
}
|
||||
};
|
||||
@@ -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('order_items', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('print_stock_id')->nullable()->after('product_id');
|
||||
$table->foreign('print_stock_id')->references('id')->on('print_stocks')->onDelete('set null');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->dropForeign(['print_stock_id']);
|
||||
$table->dropColumn('print_stock_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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('users', function (Blueprint $table) {
|
||||
$table->boolean('is_admin')->default(false)->after('email');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('is_admin');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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('products', function (Blueprint $table) {
|
||||
$table->enum('type', ['wallpaper', 'mural'])->default('wallpaper')->after('stock');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropColumn('type');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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::create('product_images', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('product_id')->constrained()->onDelete('cascade');
|
||||
$table->string('image_path');
|
||||
$table->integer('sort_order')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('product_images');
|
||||
}
|
||||
};
|
||||
@@ -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('print_stocks', function (Blueprint $table) {
|
||||
$table->decimal('width', 8, 2)->default(1)->after('type');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('print_stocks', function (Blueprint $table) {
|
||||
$table->dropColumn('width');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
// Check if uuid column already exists from previous failed migration
|
||||
if (!Schema::hasColumn('orders', 'uuid')) {
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
// Add UUID column
|
||||
$table->uuid('uuid')->nullable()->unique()->after('id');
|
||||
});
|
||||
}
|
||||
|
||||
// Populate existing orders with UUIDs
|
||||
DB::table('orders')->whereNull('uuid')->update([
|
||||
'uuid' => DB::raw('UUID()')
|
||||
]);
|
||||
|
||||
// Make UUID non-nullable
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->uuid('uuid')->nullable(false)->change();
|
||||
});
|
||||
|
||||
// Temporarily disable foreign key checks
|
||||
DB::statement('SET FOREIGN_KEY_CHECKS=0');
|
||||
|
||||
// Drop the foreign key constraint on order_items
|
||||
DB::statement('ALTER TABLE `order_items` DROP FOREIGN KEY `order_items_order_id_foreign`');
|
||||
|
||||
// Change order_id column in order_items to uuid type first
|
||||
// Get the UUID values from orders and map them to order_items
|
||||
DB::statement('ALTER TABLE `order_items` MODIFY `order_id` CHAR(36) NULL');
|
||||
|
||||
// Update order_items with uuid values from orders
|
||||
DB::statement('UPDATE `order_items` oi INNER JOIN `orders` o ON oi.order_id = o.id SET oi.order_id = o.uuid');
|
||||
|
||||
// Make order_id non-nullable
|
||||
DB::statement('ALTER TABLE `order_items` MODIFY `order_id` CHAR(36) NOT NULL');
|
||||
|
||||
// Remove auto_increment from id column, then drop it and make uuid the primary key
|
||||
DB::statement('ALTER TABLE `orders` MODIFY `id` INT NOT NULL');
|
||||
DB::statement('ALTER TABLE `orders` DROP PRIMARY KEY, ADD PRIMARY KEY (`uuid`)');
|
||||
DB::statement('ALTER TABLE `orders` DROP COLUMN `id`');
|
||||
|
||||
// Recreate the foreign key constraint on order_items pointing to uuid
|
||||
DB::statement('ALTER TABLE `order_items` ADD CONSTRAINT `order_items_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders`(`uuid`) ON DELETE CASCADE');
|
||||
|
||||
// Re-enable foreign key checks
|
||||
DB::statement('SET FOREIGN_KEY_CHECKS=1');
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// Disable foreign key checks
|
||||
DB::statement('SET FOREIGN_KEY_CHECKS=0');
|
||||
|
||||
// Drop the uuid-based foreign key
|
||||
DB::statement('ALTER TABLE `order_items` DROP FOREIGN KEY `order_items_order_id_foreign`');
|
||||
|
||||
// Check if id column still exists, if not we need to restore it
|
||||
if (!Schema::hasColumn('orders', 'id')) {
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->id()->first();
|
||||
});
|
||||
}
|
||||
|
||||
// Convert order_id back to integer and update references
|
||||
DB::statement('ALTER TABLE `order_items` MODIFY `order_id` BIGINT UNSIGNED NULL');
|
||||
|
||||
// Update order_items with id values from orders
|
||||
DB::statement('UPDATE `order_items` oi INNER JOIN `orders` o ON oi.order_id = o.uuid SET oi.order_id = o.id');
|
||||
|
||||
// Make order_id non-nullable
|
||||
DB::statement('ALTER TABLE `order_items` MODIFY `order_id` BIGINT UNSIGNED NOT NULL');
|
||||
|
||||
// Recreate the original foreign key pointing to id
|
||||
DB::statement('ALTER TABLE `order_items` ADD CONSTRAINT `order_items_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders`(`id`) ON DELETE CASCADE');
|
||||
|
||||
// Drop uuid column if it exists
|
||||
if (Schema::hasColumn('orders', 'uuid')) {
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->dropUnique(['uuid']);
|
||||
$table->dropColumn('uuid');
|
||||
});
|
||||
}
|
||||
|
||||
// Re-enable foreign key checks
|
||||
DB::statement('SET FOREIGN_KEY_CHECKS=1');
|
||||
}
|
||||
};
|
||||
@@ -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('hero_images', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->enum('page', ['home', 'wallpaper', 'mural']);
|
||||
$table->string('image_path');
|
||||
$table->string('title');
|
||||
$table->text('description')->nullable();
|
||||
$table->string('button_text')->nullable();
|
||||
$table->string('button_link')->nullable();
|
||||
$table->integer('sort_order')->default(0);
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('page');
|
||||
$table->index('is_active');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('hero_images');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class AdminUserSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
User::create([
|
||||
'name' => 'Admin User',
|
||||
'email' => 'admin@additionaldesign.com',
|
||||
'password' => Hash::make('password'),
|
||||
'is_admin' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
use WithoutModelEvents;
|
||||
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->call([
|
||||
AdminUserSeeder::class,
|
||||
ProductSeeder::class,
|
||||
PrintStockSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\PrintStock;
|
||||
use App\Models\Product;
|
||||
|
||||
class PrintStockSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$stocks = [
|
||||
[
|
||||
'name' => 'Standard Matte',
|
||||
'description' => 'Classic matte finish wallpaper. Professional appearance with subtle texture.',
|
||||
'cost_per_meter' => 8.50,
|
||||
'cost_per_m2' => 85.00,
|
||||
'type' => 'both'
|
||||
],
|
||||
[
|
||||
'name' => 'Premium Silk',
|
||||
'description' => 'Smooth silk finish with subtle sheen. Elegant and durable.',
|
||||
'cost_per_meter' => 12.50,
|
||||
'cost_per_m2' => 125.00,
|
||||
'type' => 'both'
|
||||
],
|
||||
[
|
||||
'name' => 'Luxury Velvet',
|
||||
'description' => 'Rich velvet texture with premium feel. High-end luxury option.',
|
||||
'cost_per_meter' => 16.00,
|
||||
'cost_per_m2' => 160.00,
|
||||
'type' => 'both'
|
||||
],
|
||||
[
|
||||
'name' => 'Canvas',
|
||||
'description' => 'Textured canvas finish. Great for artistic designs.',
|
||||
'cost_per_meter' => 14.00,
|
||||
'cost_per_m2' => 140.00,
|
||||
'type' => 'both'
|
||||
],
|
||||
[
|
||||
'name' => 'Glossy',
|
||||
'description' => 'Shiny glossy finish. Vibrant colors and easy to clean.',
|
||||
'cost_per_meter' => 10.00,
|
||||
'cost_per_m2' => 100.00,
|
||||
'type' => 'both'
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($stocks as $stock) {
|
||||
PrintStock::create($stock);
|
||||
}
|
||||
|
||||
// Attach all stocks to all products
|
||||
$products = Product::all();
|
||||
$stockIds = PrintStock::pluck('id')->toArray();
|
||||
|
||||
foreach ($products as $product) {
|
||||
$product->printStocks()->sync($stockIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\Category;
|
||||
use App\Models\Product;
|
||||
|
||||
class ProductSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// Create categories
|
||||
$categories = [
|
||||
[
|
||||
'name' => 'Botanical',
|
||||
'slug' => 'botanical',
|
||||
'description' => 'Organic prints featuring flora and nature-inspired designs.',
|
||||
'image' => 'https://images.unsplash.com/photo-1518895949257-7621c3c786d7?w=400&q=80'
|
||||
],
|
||||
[
|
||||
'name' => 'Vintage',
|
||||
'slug' => 'vintage',
|
||||
'description' => 'Timeless patterns with a nostalgic charm and elegance.',
|
||||
'image' => 'https://images.unsplash.com/photo-1631049307264-da0ec9d70304?w=500&q=80'
|
||||
],
|
||||
[
|
||||
'name' => 'Modern Murals',
|
||||
'slug' => 'modern-murals',
|
||||
'description' => 'Bold, statement-making designs for contemporary spaces.',
|
||||
'image' => 'https://images.unsplash.com/photo-1460661419201-fd4cecdf8a8b?w=400&q=80'
|
||||
],
|
||||
[
|
||||
'name' => 'Texture',
|
||||
'slug' => 'texture',
|
||||
'description' => 'Dimensional prints that add depth and tactile interest.',
|
||||
'image' => 'https://images.unsplash.com/photo-1578926078328-123alce3f3ce?w=400&q=80'
|
||||
],
|
||||
[
|
||||
'name' => 'Floral',
|
||||
'slug' => 'floral',
|
||||
'description' => 'Exquisite flower-based patterns in varied aesthetics.',
|
||||
'image' => 'https://images.unsplash.com/photo-1520763185298-1b434c919eba?w=400&q=80'
|
||||
],
|
||||
[
|
||||
'name' => 'Geometric',
|
||||
'slug' => 'geometric',
|
||||
'description' => 'Clean lines and striking forms for minimalist design.',
|
||||
'image' => 'https://images.unsplash.com/photo-1577720643272-265f434b3f6f?w=400&q=80'
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($categories as $category) {
|
||||
Category::create($category);
|
||||
}
|
||||
|
||||
// Create products
|
||||
$products = [
|
||||
// Botanical wallpapers
|
||||
[
|
||||
'category_id' => 1,
|
||||
'name' => 'Serenity Bloom',
|
||||
'slug' => 'serenity-bloom',
|
||||
'description' => 'Soft botanical watercolors perfect for bedroom spaces. Creates a peaceful, nature-inspired atmosphere.',
|
||||
'price' => 64.99,
|
||||
'image' => 'https://images.unsplash.com/photo-1577720643272-265f434b3f6f?w=500&q=80',
|
||||
'stock' => 50,
|
||||
'featured' => true,
|
||||
'type' => 'wallpaper'
|
||||
],
|
||||
[
|
||||
'category_id' => 1,
|
||||
'name' => 'Tropical Paradise',
|
||||
'slug' => 'tropical-paradise',
|
||||
'description' => 'Vibrant tropical foliage for adventurous interiors. Brings warmth and energy to any room.',
|
||||
'price' => 62.99,
|
||||
'image' => 'https://images.unsplash.com/photo-1520763185298-1b434c919eba?w=500&q=80',
|
||||
'stock' => 45,
|
||||
'featured' => true,
|
||||
'type' => 'wallpaper'
|
||||
],
|
||||
[
|
||||
'category_id' => 1,
|
||||
'name' => 'Coastal Breeze',
|
||||
'slug' => 'coastal-breeze',
|
||||
'description' => 'Serene seaside-inspired patterns in soft blues. Brings a refreshing, airy feel to spaces.',
|
||||
'price' => 61.99,
|
||||
'image' => 'https://images.unsplash.com/photo-1505142468610-359e7d316be0?w=500&q=80',
|
||||
'stock' => 40,
|
||||
'featured' => false,
|
||||
'type' => 'wallpaper'
|
||||
],
|
||||
[
|
||||
'category_id' => 1,
|
||||
'name' => 'Forest Canopy',
|
||||
'slug' => 'forest-canopy',
|
||||
'description' => 'Deep greens and natural textures inspired by forest landscapes.',
|
||||
'price' => 63.99,
|
||||
'image' => 'https://images.unsplash.com/photo-1518895949257-7621c3c786d7?w=500&q=80',
|
||||
'stock' => 35,
|
||||
'featured' => false,
|
||||
'type' => 'wallpaper'
|
||||
],
|
||||
|
||||
// Vintage wallpapers
|
||||
[
|
||||
'category_id' => 2,
|
||||
'name' => 'Heritage Gold',
|
||||
'slug' => 'heritage-gold',
|
||||
'description' => 'Ornamental pattern with metallic accents. Adds elegance and timeless sophistication.',
|
||||
'price' => 72.99,
|
||||
'image' => 'https://images.unsplash.com/photo-1578500494198-246f612d03b3?w=500&q=80',
|
||||
'stock' => 30,
|
||||
'featured' => true,
|
||||
'type' => 'wallpaper'
|
||||
],
|
||||
[
|
||||
'category_id' => 2,
|
||||
'name' => 'Antique Damask',
|
||||
'slug' => 'antique-damask',
|
||||
'description' => 'Classic damask pattern with vintage charm and luxury appeal.',
|
||||
'price' => 70.99,
|
||||
'image' => 'https://images.unsplash.com/photo-1578500494198-246f612d03b3?w=500&q=80',
|
||||
'stock' => 28,
|
||||
'featured' => false,
|
||||
'type' => 'wallpaper'
|
||||
],
|
||||
|
||||
// Modern Murals (per m²)
|
||||
[
|
||||
'category_id' => 3,
|
||||
'name' => 'Abstract Vision',
|
||||
'slug' => 'abstract-vision',
|
||||
'description' => 'Bold abstract designs perfect for making a statement in any space. Single non-repeating image.',
|
||||
'price' => 155.00,
|
||||
'image' => 'https://images.unsplash.com/photo-1460661419201-fd4cecdf8a8b?w=500&q=80',
|
||||
'stock' => 15,
|
||||
'featured' => true,
|
||||
'type' => 'mural'
|
||||
],
|
||||
[
|
||||
'category_id' => 3,
|
||||
'name' => 'Urban Sunset',
|
||||
'slug' => 'urban-sunset',
|
||||
'description' => 'Breathtaking cityscape at dusk. Perfect for modern living spaces and offices.',
|
||||
'price' => 168.00,
|
||||
'image' => 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=500&q=80',
|
||||
'stock' => 12,
|
||||
'featured' => true,
|
||||
'type' => 'mural'
|
||||
],
|
||||
[
|
||||
'category_id' => 3,
|
||||
'name' => 'Mountain Peak',
|
||||
'slug' => 'mountain-peak',
|
||||
'description' => 'Dramatic mountain landscape mural for inspiring spaces. Brings nature indoors.',
|
||||
'price' => 145.00,
|
||||
'image' => 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=500&q=80',
|
||||
'stock' => 10,
|
||||
'featured' => false,
|
||||
'type' => 'mural'
|
||||
],
|
||||
[
|
||||
'category_id' => 3,
|
||||
'name' => 'Ocean Waves',
|
||||
'slug' => 'ocean-waves',
|
||||
'description' => 'Serene ocean waves in calming blues. Perfect for creating peaceful environments.',
|
||||
'price' => 138.00,
|
||||
'image' => 'https://images.unsplash.com/photo-1505142468610-359e7d316be0?w=500&q=80',
|
||||
'stock' => 8,
|
||||
'featured' => false,
|
||||
'type' => 'mural'
|
||||
],
|
||||
|
||||
// Texture wallpapers
|
||||
[
|
||||
'category_id' => 4,
|
||||
'name' => 'Marble Dream',
|
||||
'slug' => 'marble-dream',
|
||||
'description' => 'Luxurious marble texture wallpaper for elegant spaces. Adds depth and sophistication.',
|
||||
'price' => 68.99,
|
||||
'image' => 'https://images.unsplash.com/photo-1578926078328-123alce3f3ce?w=500&q=80',
|
||||
'stock' => 32,
|
||||
'featured' => true,
|
||||
'type' => 'wallpaper'
|
||||
],
|
||||
[
|
||||
'category_id' => 4,
|
||||
'name' => 'Stone Elegance',
|
||||
'slug' => 'stone-elegance',
|
||||
'description' => 'Natural stone textures that create a sophisticated backdrop.',
|
||||
'price' => 66.99,
|
||||
'image' => 'https://images.unsplash.com/photo-1578926078328-123alce3f3ce?w=500&q=80',
|
||||
'stock' => 29,
|
||||
'featured' => false,
|
||||
'type' => 'wallpaper'
|
||||
],
|
||||
|
||||
// Floral wallpapers
|
||||
[
|
||||
'category_id' => 5,
|
||||
'name' => 'Crimson Velvet',
|
||||
'slug' => 'crimson-velvet',
|
||||
'description' => 'Luxe floral design in rich, deep tones. Creates a dramatic, sophisticated atmosphere.',
|
||||
'price' => 66.99,
|
||||
'image' => 'https://images.unsplash.com/photo-1581092918056-0c4c3acd3789?w=500&q=80',
|
||||
'stock' => 27,
|
||||
'featured' => false,
|
||||
'type' => 'wallpaper'
|
||||
],
|
||||
[
|
||||
'category_id' => 5,
|
||||
'name' => 'Rose Garden',
|
||||
'slug' => 'rose-garden',
|
||||
'description' => 'Delicate rose patterns perfect for romantic and elegant interiors.',
|
||||
'price' => 65.99,
|
||||
'image' => 'https://images.unsplash.com/photo-1581092918056-0c4c3acd3789?w=500&q=80',
|
||||
'stock' => 24,
|
||||
'featured' => false,
|
||||
'type' => 'wallpaper'
|
||||
],
|
||||
|
||||
// Geometric wallpapers
|
||||
[
|
||||
'category_id' => 6,
|
||||
'name' => 'Urban Grid',
|
||||
'slug' => 'urban-grid',
|
||||
'description' => 'Contemporary geometric pattern for modern interiors. Perfect for creating bold, structured spaces.',
|
||||
'price' => 59.99,
|
||||
'image' => 'https://images.unsplash.com/photo-1557672172-298e090d0f80?w=500&q=80',
|
||||
'stock' => 38,
|
||||
'featured' => true,
|
||||
'type' => 'wallpaper'
|
||||
],
|
||||
[
|
||||
'category_id' => 6,
|
||||
'name' => 'Minimalist Zen',
|
||||
'slug' => 'minimalist-zen',
|
||||
'description' => 'Clean, serene design with Japanese-inspired aesthetics. Perfect for creating calm spaces.',
|
||||
'price' => 55.99,
|
||||
'image' => 'https://images.unsplash.com/photo-1511884642898-4c92249e20b6?w=500&q=80',
|
||||
'stock' => 42,
|
||||
'featured' => true,
|
||||
'type' => 'wallpaper'
|
||||
],
|
||||
[
|
||||
'category_id' => 6,
|
||||
'name' => 'Graphic Statements',
|
||||
'slug' => 'graphic-statements',
|
||||
'description' => 'Bold abstract graphics for contemporary spaces. Makes a powerful design statement.',
|
||||
'price' => 65.99,
|
||||
'image' => 'https://images.unsplash.com/photo-1577720643272-265f434b3f6f?w=500&q=80',
|
||||
'stock' => 33,
|
||||
'featured' => false,
|
||||
'type' => 'wallpaper'
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($products as $product) {
|
||||
Product::create($product);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user