Skip to content

Commit

Permalink
expense claim tables added
Browse files Browse the repository at this point in the history
  • Loading branch information
dhanuSama committed Mar 24, 2023
1 parent a1f4603 commit 34c8f88
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,30 @@ public function up()
$table->dateTime('leave_at')->nullable();
$table->timestamps();
});

Schema::create('hrm_claim_types', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});

Schema::create('hrm_expense_claims', function (Blueprint $table) {
$table->id();
$table->foreignId('emp_id')->constrained('hrm_employees')->cascadeOnUpdate()->cascadeOnDelete();
$table->foreignId('payroll_period_id')->constrained('hrm_payroll_periods')->cascadeOnUpdate()->restrictOnDelete();
$table->foreignId('claim_type_id')->constrained('hrm_claim_types')->cascadeOnUpdate()->restrictOnDelete();
$table->date('claimed_at');
$table->double('claimed_amount', 8, 2);
$table->string('reason');
$table->enum('status', ['Approved', 'Rejected', 'Pending']);
$table->timestamps();
});
}

public function down()
{
Schema::dropIfExists('hrm_expense_claims');
Schema::dropIfExists('hrm_claim_types');
Schema::dropIfExists('hrm_employee_attendances');
Schema::dropIfExists('hrm_payroll_employees');
Schema::dropIfExists('hrm_payment_method_details');
Expand Down
12 changes: 12 additions & 0 deletions src/Models/Claim.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Visanduma\LaravelHrm\Models;

use Illuminate\Database\Eloquent\Model;

class Claim extends Model
{
protected $table = 'hrm_expense_claims';

protected $guarded = [];
}
12 changes: 12 additions & 0 deletions src/Models/ClaimType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Visanduma\LaravelHrm\Models;

use Illuminate\Database\Eloquent\Model;

class ClaimType extends Model
{
protected $table = 'hrm_claim_types';

protected $guarded = [];
}
2 changes: 1 addition & 1 deletion src/Models/Designation.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class Designation extends Model

public function skills()
{
return $this->belongsToMany(Skill::class, 'hrm_designation_skills');
return $this->belongsToMany(Skill::class, 'hrm_designation_skills', 'desig_id', 'skill_id');
}
}

0 comments on commit 34c8f88

Please sign in to comment.