add inventory and supply logic

This commit is contained in:
root
2026-03-10 18:21:08 -04:00
parent 17d73e2f92
commit 25e7b3c67c
62 changed files with 3846 additions and 2781 deletions
@@ -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::create('supply_categories', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('supply_categories');
}
};
@@ -0,0 +1,44 @@
<?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('suppliers', function (Blueprint $table) {
if (!Schema::hasColumn('suppliers', 'email')) {
$table->string('email')->nullable()->after('name');
}
if (!Schema::hasColumn('suppliers', 'phone')) {
$table->string('phone')->nullable()->after('email');
}
if (!Schema::hasColumn('suppliers', 'address')) {
$table->string('address')->nullable()->after('phone');
}
if (!Schema::hasColumn('suppliers', 'notes')) {
$table->text('notes')->nullable()->after('address');
}
});
}
public function down(): void
{
Schema::table('suppliers', function (Blueprint $table) {
if (Schema::hasColumn('suppliers', 'notes')) {
$table->dropColumn('notes');
}
if (Schema::hasColumn('suppliers', 'address')) {
$table->dropColumn('address');
}
if (Schema::hasColumn('suppliers', 'phone')) {
$table->dropColumn('phone');
}
if (Schema::hasColumn('suppliers', 'email')) {
$table->dropColumn('email');
}
});
}
};