chore: update document approval workflow and bug fixes

This commit is contained in:
2026-05-25 13:05:20 +08:00
parent d573c02893
commit 39a8e1d4cd
910 changed files with 49994 additions and 1010 deletions

View File

@@ -0,0 +1,39 @@
<?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('approval_chains', function (Blueprint $table) {
$table->id();
$table->morphs('approvable'); // approvable_type + approvable_id
$table->string('type')->default('general'); // e.g., material_request, invoice, purchase_order
$table->string('status')->default('pending');
$table->text('notes')->nullable();
$table->foreignId('initiated_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamp('completed_at')->nullable();
$table->timestamps();
});
Schema::create('approval_steps', function (Blueprint $table) {
$table->id();
$table->foreignId('approval_chain_id')->constrained()->cascadeOnDelete();
$table->foreignId('approver_id')->constrained('users')->cascadeOnDelete();
$table->integer('order')->default(0);
$table->string('status')->default('pending');
$table->text('notes')->nullable();
$table->timestamp('acted_at')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('approval_steps');
Schema::dropIfExists('approval_chains');
}
};

View File

@@ -0,0 +1,16 @@
<?php
namespace Modules\ApprovalWorkflow\Database\Seeders;
use Illuminate\Database\Seeder;
class ApprovalWorkflowDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $this->call([]);
}
}