You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace App\Models;
  3. use App\Models\Common\Contact;
  4. use App\Models\Core\Department;
  5. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  6. use Illuminate\Database\Eloquent\Relations\HasMany;
  7. use Wallo\FilamentCompanies\Employeeship as FilamentCompaniesEmployeeship;
  8. use Wallo\FilamentCompanies\FilamentCompanies;
  9. class Employeeship extends FilamentCompaniesEmployeeship
  10. {
  11. /**
  12. * Indicates if the IDs are auto-incrementing.
  13. *
  14. * @var bool
  15. */
  16. public $incrementing = true;
  17. protected $fillable = [
  18. 'company_id',
  19. 'user_id',
  20. 'contact_id',
  21. 'role',
  22. 'employment_type',
  23. 'hire_date',
  24. 'start_date',
  25. 'department_id',
  26. 'job_title',
  27. 'photo',
  28. 'date_of_birth',
  29. 'gender',
  30. 'marital_status',
  31. 'nationality',
  32. 'compensation_amount',
  33. 'compensation_type',
  34. 'compensation_frequency',
  35. 'bank_account_number',
  36. 'education_level',
  37. 'field_of_study',
  38. 'school_name',
  39. 'emergency_contact_name',
  40. 'emergency_contact_phone_number',
  41. 'emergency_contact_email',
  42. ];
  43. public function company(): BelongsTo
  44. {
  45. return $this->belongsTo(FilamentCompanies::companyModel(), 'company_id');
  46. }
  47. public function user(): BelongsTo
  48. {
  49. return $this->belongsTo(FilamentCompanies::userModel(), 'user_id');
  50. }
  51. public function contact(): BelongsTo
  52. {
  53. return $this->belongsTo(Contact::class, 'contact_id');
  54. }
  55. public function department(): BelongsTo
  56. {
  57. return $this->belongsTo(Department::class, 'department_id');
  58. }
  59. public function managedDepartments(): HasMany
  60. {
  61. return $this->hasMany(Department::class, 'manager_id');
  62. }
  63. public function getNameAttribute(): string
  64. {
  65. return $this->user->name;
  66. }
  67. }