Erster Upload

This commit is contained in:
Malek Tellissi
2026-09-11 01:17:47 +02:00
commit 400172cdde
171 changed files with 18844 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
*.sqlite*
+44
View File
@@ -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,
]);
}
}
+282
View File
@@ -0,0 +1,282 @@
create table
`users` (
`id` bigint unsigned not null auto_increment primary key,
`name` varchar(255) not null,
`email` varchar(255) not null,
`email_verified_at` timestamp null,
`password` varchar(255) not null,
`remember_token` varchar(100) null,
`created_at` timestamp null,
`updated_at` timestamp null
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
alter table `users` add unique `users_email_unique` (`email`);
create table
`password_reset_tokens` (
`email` varchar(255) not null,
`token` varchar(255) not null,
`created_at` timestamp null,
primary key (`email`)
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
create table
`sessions` (
`id` varchar(255) not null,
`user_id` bigint unsigned null,
`ip_address` varchar(45) null,
`user_agent` text null,
`payload` longtext not null,
`last_activity` int not null,
primary key (`id`)
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
alter table `sessions` add index `sessions_user_id_index` (`user_id`);
alter table `sessions` add index `sessions_last_activity_index` (`last_activity`);
create table
`cache` (
`key` varchar(255) not null,
`value` mediumtext not null,
`expiration` int not null,
primary key (`key`)
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
create table
`cache_locks` (
`key` varchar(255) not null,
`owner` varchar(255) not null,
`expiration` int not null,
primary key (`key`)
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
create table
`jobs` (
`id` bigint unsigned not null auto_increment primary key,
`queue` varchar(255) not null,
`payload` longtext not null,
`attempts` tinyint unsigned not null,
`reserved_at` int unsigned null,
`available_at` int unsigned not null,
`created_at` int unsigned not null
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
alter table `jobs` add index `jobs_queue_index` (`queue`);
create table
`job_batches` (
`id` varchar(255) not null,
`name` varchar(255) not null,
`total_jobs` int not null,
`pending_jobs` int not null,
`failed_jobs` int not null,
`failed_job_ids` longtext not null,
`options` mediumtext null,
`cancelled_at` int null,
`created_at` int not null,
`finished_at` int null,
primary key (`id`)
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
create table
`failed_jobs` (
`id` bigint unsigned not null auto_increment primary key,
`uuid` varchar(255) not null,
`connection` text not null,
`queue` text not null,
`payload` longtext not null,
`exception` longtext not null,
`failed_at` timestamp not null default CURRENT_TIMESTAMP
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
alter table `failed_jobs` add unique `failed_jobs_uuid_unique` (`uuid`);
create table
`packings` (
`id` bigint unsigned not null auto_increment primary key,
`name` varchar(255) not null,
`size` decimal(10, 2) not null,
`created_at` timestamp null,
`updated_at` timestamp null
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
create table
`recipes` (
`id` bigint unsigned not null auto_increment primary key,
`name` varchar(255) not null,
`description` text null,
`created_at` timestamp null,
`updated_at` timestamp null
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
create table
`spices` (
`id` bigint unsigned not null auto_increment primary key,
`name` varchar(255) not null,
`quantity` decimal(10, 2) not null default '0',
`unit` varchar(255) not null,
`created_at` timestamp null,
`updated_at` timestamp null
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
create table
`suppliers` (
`id` bigint unsigned not null auto_increment primary key,
`name` varchar(255) not null,
`created_at` timestamp null,
`updated_at` timestamp null
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
create table
`spices_suppliers` (
`id` bigint unsigned not null auto_increment primary key,
`spice_id` bigint unsigned not null,
`supplier_id` bigint unsigned not null,
`amount` decimal(10, 2) not null,
`supplied_at` timestamp null,
`created_at` timestamp null,
`updated_at` timestamp null
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
alter table `spices_suppliers` add constraint `spices_suppliers_spice_id_foreign` foreign key (`spice_id`) references `spices` (`id`) on delete cascade;
alter table `spices_suppliers` add constraint `spices_suppliers_supplier_id_foreign` foreign key (`supplier_id`) references `suppliers` (`id`) on delete cascade;
create table
`products` (
`id` bigint unsigned not null auto_increment primary key,
`title` text not null,
`images` json null,
`description` text null,
`package_content` text null,
`recipes_id` bigint unsigned not null,
`created_at` timestamp null,
`updated_at` timestamp null
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
alter table `products` add constraint `products_recipes_id_foreign` foreign key (`recipes_id`) references `recipes` (`id`) on delete cascade;
alter table `products` add unique `products_gtin_unique` (`gtin`);
create table
`products_sizes` (
`id` bigint unsigned not null auto_increment primary key,
`product_id` bigint unsigned not null,
`packing_id` bigint unsigned not null,
`gtin` bigint unsigned,
`description` varchar(255) null,
`price` float (53) not null,
`created_at` timestamp null,
`updated_at` timestamp null
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
alter table `products_sizes` add constraint `products_sizes_product_id_foreign` foreign key (`product_id`) references `products` (`id`) on delete cascade;
alter table `products_sizes` add constraint `products_sizes_packing_id_foreign` foreign key (`packing_id`) references `packings` (`id`) on delete cascade;
create table
`products_inventory` (
`id` bigint unsigned not null auto_increment primary key,
`product_id` bigint unsigned not null,
`size_id` bigint unsigned not null,
`out_at` timestamp null,
`created_at` timestamp null,
`updated_at` timestamp null
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
alter table `products_inventory` add constraint `products_inventory_product_id_foreign` foreign key (`product_id`) references `products` (`id`);
alter table `products_inventory` add constraint `products_inventory_size_id_foreign` foreign key (`size_id`) references `products_sizes` (`id`);
create table
`products_sales` (
`id` bigint unsigned not null auto_increment primary key,
`product_id` bigint unsigned not null,
`size_id` bigint unsigned not null,
`amount` int not null,
`comment` text null,
`sold_at` timestamp not null,
`created_at` timestamp null,
`updated_at` timestamp null
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
alter table `products_sales` add constraint `products_sales_product_id_foreign` foreign key (`product_id`) references `products` (`id`);
alter table `products_sales` add constraint `products_sales_size_id_foreign` foreign key (`size_id`) references `products_sizes` (`id`);
create table
`recipes_spices` (
`id` bigint unsigned not null auto_increment primary key,
`recipe_id` bigint unsigned not null,
`spice_id` bigint unsigned not null,
`amount_in_percent` decimal(4, 2) not null,
`created_at` timestamp null,
`updated_at` timestamp null
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
alter table `recipes_spices` add constraint `recipes_spices_recipe_id_foreign` foreign key (`recipe_id`) references `recipes` (`id`) on delete cascade;
alter table `recipes_spices` add constraint `recipes_spices_spice_id_foreign` foreign key (`spice_id`) references `spices` (`id`) on delete cascade;
create table
`activity_log` (
`id` bigint unsigned not null auto_increment primary key,
`log_name` varchar(255) null,
`description` text not null,
`subject_type` varchar(255) null,
`subject_id` bigint unsigned null,
`causer_type` varchar(255) null,
`causer_id` bigint unsigned null,
`properties` json null,
`created_at` timestamp null,
`updated_at` timestamp null
) default character
set
utf8mb4 collate 'utf8mb4_unicode_ci';
alter table `activity_log` add index `subject` (`subject_type`, `subject_id`);
alter table `activity_log` add index `causer` (`causer_type`, `causer_id`);
alter table `activity_log` add index `activity_log_log_name_index` (`log_name`);
alter table `activity_log` add `event` varchar(255) null after `subject_type`;
alter table `activity_log` add `batch_uuid` char(36) null after `properties`;
@@ -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,30 @@
<?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()
{
Schema::create('packings', function (Blueprint $table) {
$table->id(); // Primärschlüssel
$table->string('name'); // Name der Verpackung
$table->decimal('size', 10, 2); // Größe in Gramm
$table->timestamps(); // created_at und updated_at
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};
@@ -0,0 +1,29 @@
<?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('recipes', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('description')->nullable();
$table->timestamps(); // created_at und updated_at
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('recipes');
}
};
@@ -0,0 +1,30 @@
<?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('spices', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->decimal('quantity', 10, 2)->default(0);
$table->string('unit');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('spices');
}
};
@@ -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::create('suppliers', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('suppliers');
}
};
@@ -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('spices_suppliers', function (Blueprint $table) {
$table->id();
$table->foreignId('spice_id')->constrained('spices')->onDelete('cascade');
$table->foreignId('supplier_id')->constrained('suppliers')->onDelete('cascade');
$table->decimal('amount', 10, 2);
$table->timestamp('supplied_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('spices_suppliers');
}
};
@@ -0,0 +1,34 @@
<?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->text('title');
$table->json('images')->nullable();
$table->text('description')->nullable();
$table->text('package_content')->nullable();
$table->foreignId('recipes_id')->constrained('recipes')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('products');
}
};
@@ -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 {
/**
* Run the migrations.
*/
public function up(): void {
Schema::create('products_sizes', function (Blueprint $table) {
$table->id(); // id as primary key
$table->foreignId('product_id')->constrained('products')->onDelete('cascade'); // foreign key to products
$table->foreignId('packing_id')->constrained('packings')->onDelete('cascade'); // foreign key to products
$table->unsignedBigInteger('gtin')->nullable();
$table->string('description')->nullable();
$table->float('price'); // product price
$table->timestamps(); // created_at and updated_at
});
}
public function down()
{
Schema::dropIfExists('products_sizes');
}
};
@@ -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('products_inventory', function (Blueprint $table) {
$table->id();
$table->foreignId('product_id')->constrained('products');
$table->foreignId('size_id')->constrained('products_sizes');
$table->timestamp('out_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('product_inventory');
}
};
@@ -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('products_sales', function (Blueprint $table) {
$table->id();
$table->foreignId('product_id')->constrained('products');
$table->foreignId('size_id')->constrained('products_sizes');
$table->integer('amount');
$table->text('comment')->nullable();
$table->timestamp('sold_at');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('product_inventory');
}
};
@@ -0,0 +1,30 @@
<?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('recipes_spices', function (Blueprint $table) {
$table->id();
$table->foreignId('recipe_id')->constrained('recipes')->onDelete('cascade');
$table->foreignId('spice_id')->constrained('spices')->onDelete('cascade');
$table->decimal('amount_in_percent', 4, 2);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('recipes_spices');
}
};
@@ -0,0 +1,27 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateActivityLogTable extends Migration
{
public function up()
{
Schema::connection(config('activitylog.database_connection'))->create(config('activitylog.table_name'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('log_name')->nullable();
$table->text('description');
$table->nullableMorphs('subject', 'subject');
$table->nullableMorphs('causer', 'causer');
$table->json('properties')->nullable();
$table->timestamps();
$table->index('log_name');
});
}
public function down()
{
Schema::connection(config('activitylog.database_connection'))->dropIfExists(config('activitylog.table_name'));
}
}
@@ -0,0 +1,22 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddEventColumnToActivityLogTable extends Migration
{
public function up()
{
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
$table->string('event')->nullable()->after('subject_type');
});
}
public function down()
{
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
$table->dropColumn('event');
});
}
}
@@ -0,0 +1,22 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddBatchUuidColumnToActivityLogTable extends Migration
{
public function up()
{
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
$table->char('batch_uuid', 36)->nullable()->after('properties');
});
}
public function down()
{
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
$table->dropColumn('batch_uuid');
});
}
}
@@ -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('batches', function (Blueprint $table) {
$table->id();
$table->string('lot_number')->unique();
$table->foreignId('product_id')->constrained('products')->cascadeOnDelete();
$table->foreignId('recipe_id')->constrained('recipes')->cascadeOnDelete();
$table->date('produced_at')->nullable();
$table->date('expires_at')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('batches');
}
};
@@ -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('batch_origins', function (Blueprint $table) {
$table->id();
$table->foreignId('batch_id')->constrained('batches')->cascadeOnDelete();
$table->foreignId('spice_id')->constrained('spices')->cascadeOnDelete();
$table->foreignId('supplier_id')->nullable()->constrained('suppliers')->nullOnDelete();
$table->string('origin_country')->nullable();
$table->string('farmer')->nullable();
$table->text('notes')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('batch_origins');
}
};
@@ -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
{
// Produkte können ohne Rezeptur existieren (z.B. nach Import)
Schema::table('products', function (Blueprint $table) {
$table->foreignId('recipes_id')->nullable()->change();
});
// SKU-Spalte für Shopify-Produktvarianten
Schema::table('products_sizes', function (Blueprint $table) {
$table->string('sku')->nullable()->after('packing_id');
});
}
public function down(): void
{
Schema::table('products_sizes', function (Blueprint $table) {
$table->dropColumn('sku');
});
Schema::table('products', function (Blueprint $table) {
$table->foreignId('recipes_id')->nullable(false)->change();
});
}
};
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace Database\Seeders;
use App\Models\User;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
// User::factory(10)->create();
User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
]);
}
}