chore: update document approval workflow and bug fixes
This commit is contained in:
@@ -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');
|
||||
}
|
||||
};
|
||||
0
Modules/ApprovalWorkflow/database/seeders/.gitkeep
Normal file
0
Modules/ApprovalWorkflow/database/seeders/.gitkeep
Normal 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([]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user