update addon HRM
Some checks failed
Build, Push and Deploy / build-and-push (push) Failing after 3m30s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 15s
Build, Push and Deploy / deploy-staging (push) Has been skipped
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-05-04 23:04:09 +07:00
parent 7be161f4e4
commit 3e1b64e008
131 changed files with 8281 additions and 290 deletions

View File

@@ -0,0 +1,16 @@
<?php
namespace Modules\HrmAddon\Database\Seeders;
use Illuminate\Database\Seeder;
class HrmAddonDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@@ -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('departments', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->string('name')->nullable();
$table->text('description')->nullable();
$table->boolean('status')->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('departments');
}
};

View File

@@ -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('designations', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->text('description')->nullable();
$table->boolean('status')->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('designations');
}
};

View File

@@ -0,0 +1,36 @@
<?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('shifts', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->time('start_time');
$table->time('end_time');
$table->time('start_break_time')->nullable();
$table->time('end_break_time')->nullable();
$table->time('break_time')->nullable();
$table->string('break_status')->nullable();
$table->boolean('status')->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('shifts');
}
};

View File

@@ -0,0 +1,41 @@
<?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('employees', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->foreignId('designation_id')->nullable()->constrained()->nullOnDelete();
$table->foreignId('department_id')->nullable()->constrained()->nullOnDelete();
$table->foreignId('shift_id')->nullable()->constrained()->nullOnDelete();
$table->double('amount', 10, 2)->default(0);
$table->string('image')->nullable();
$table->string('phone');
$table->string('email')->nullable();
$table->string('gender');
$table->string('country')->nullable();
$table->date('birth_date')->nullable();
$table->date('join_date')->nullable();
$table->string('status')->default('active'); // active || terminated || suspended
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('employees');
}
};

View File

@@ -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('leave_types', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->string('name');
$table->text('description')->nullable();
$table->boolean('status')->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('leave_types');
}
};

View File

@@ -0,0 +1,37 @@
<?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('leaves', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->foreignId('employee_id')->constrained()->cascadeOnDelete();
$table->foreignId('leave_type_id')->nullable()->constrained()->nullOnDelete();
$table->foreignId('department_id')->nullable()->constrained()->nullOnDelete();
$table->date('start_date');
$table->date('end_date');
$table->double('leave_duration');
$table->string('month');
$table->string('status')->default('pending'); // rejected, pending, approved
$table->text('description')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('leaves');
}
};

View File

@@ -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('holidays', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->string('name');
$table->date('start_date');
$table->date('end_date');
$table->text('description')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('holidays');
}
};

View File

@@ -0,0 +1,36 @@
<?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('attendances', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->foreignId('employee_id')->constrained()->cascadeOnDelete();
$table->foreignId('shift_id')->nullable()->constrained()->nullOnDelete();
$table->time('time_in');
$table->time('time_out');
$table->date('date');
$table->time('duration');
$table->string('month');
$table->longText('note')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('attendances');
}
};

View File

@@ -0,0 +1,36 @@
<?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('payrolls', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->foreignId('employee_id')->constrained()->cascadeOnDelete();
$table->foreignId('payment_type_id')->nullable()->constrained()->nullOnDelete();
$table->string('month');
$table->string('puid');
$table->date('date')->nullable();
$table->double('amount', 10, 2);
$table->string('payemnt_year');
$table->longText('note')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('payrolls');
}
};

View File

@@ -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
{
// HOLIDAYS, ATTENDANCES, LEAVES, PAYROLLS, employees
foreach (['holidays', 'attendances', 'leaves', 'payrolls', 'employees'] as $tableName) {
Schema::table($tableName, function (Blueprint $table) {
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
});
}
}
public function down(): void
{
// 'holidays', 'attendances', 'leaves', 'payrolls', 'employees'
foreach (['holidays', 'attendances', 'leaves', 'payrolls', 'employees'] as $tableName) {
Schema::table($tableName, function (Blueprint $table) {
$table->dropColumn('branch_id');
});
}
}
};