PayrollStructure.php 1016 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class PayrollStructure extends Model
  5. {
  6. public function employee(){
  7. return $this->belongsTo('App\Models\Employee','employee_id','id');
  8. }
  9. public function designationName()
  10. {
  11. return $this->belongsTo('App\Models\EmploymentDetail','employee_id','employee_id')->orderBy('id','ASC');
  12. }
  13. public function grade(){
  14. return $this->belongsTo('App\Models\Grade','grade_id','id');
  15. }
  16. public function gradeHead(){
  17. return $this->hasMany('App\Models\GradeStructure','grade_id','grade_id');
  18. }
  19. public function psHead(){
  20. return $this->hasMany('App\Models\PayrollStructureDetail','structure_id','id');
  21. }
  22. public function due(){
  23. return $this->hasMany('App\Models\PayrollHistory','employee_id','employee_id');
  24. }
  25. public function payableDue(){
  26. return $this->hasMany('App\Models\PayrollHistory','employee_id','employee_id')->orderBy('created_at','DESC');
  27. }
  28. }