diff --git a/app/Models/Authorization.php b/app/Models/Authorization.php new file mode 100644 index 0000000..c23f90b --- /dev/null +++ b/app/Models/Authorization.php @@ -0,0 +1,59 @@ + 'boolean', + 'approve_eo' => 'boolean', + 'approve_dd' => 'boolean', + 'approve_so_at' => 'datetime', + 'approve_eo_at' => 'datetime', + 'approve_dd_at' => 'datetime', + ]; + + /** + * Get the permohonan that owns the authorization. + */ + public function permohonan(): BelongsTo + { + return $this->belongsTo(Permohonan::class); + } + + /** + * Get the user that owns the authorization. + */ + public function user(): BelongsTo + { + return $this->belongsTo(User::class); + } +} diff --git a/database/migrations/2025_01_01_101141_create_authorizations_table.php b/database/migrations/2025_01_01_101141_create_authorizations_table.php new file mode 100644 index 0000000..220601a --- /dev/null +++ b/database/migrations/2025_01_01_101141_create_authorizations_table.php @@ -0,0 +1,48 @@ +id(); + $table->foreignId('permohonan_id')->constrained('permohonan')->onDelete('cascade'); + $table->string('jenis'); + + // SO fields + $table->boolean('approve_so')->default(false); + $table->string('status_so')->nullable(); + $table->text('keterangan_so')->nullable(); + $table->timestamp('approve_so_at')->nullable(); + + // EO fields + $table->boolean('approve_eo')->default(false); + $table->string('status_eo')->nullable(); + $table->text('keterangan_eo')->nullable(); + $table->timestamp('approve_eo_at')->nullable(); + + // DD fields + $table->boolean('approve_dd')->default(false); + $table->string('status_dd')->nullable(); + $table->text('keterangan_dd')->nullable(); + $table->timestamp('approve_dd_at')->nullable(); + + $table->string('status')->nullable(); + $table->text('keterangan')->nullable(); + $table->text('request')->nullable(); + $table->text('alasan')->nullable(); + $table->foreignId('user_id')->nullable()->constrained('users')->onDelete('set null'); + + $table->timestamps(); + }); + } + + public function down() + { + Schema::dropIfExists('authorizations'); + } + };