first commit

This commit is contained in:
Sampanna Rimal
2024-08-27 17:48:06 +05:45
commit 53c0140f58
10839 changed files with 1125847 additions and 0 deletions

View File

View File

@@ -0,0 +1,55 @@
<?php
namespace Modules\Admin\Models;
use App\Observers\AppreciationObserver;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Notifications\Notifiable;
use Modules\Admin\Database\factories\AppreciationFactory;
use Modules\Employee\Models\Employee;
#[ObservedBy([AppreciationObserver::class])]
class Appreciation extends Model
{
use HasFactory, StatusTrait, Notifiable;
protected $table = 'tbl_appreciations';
protected $primaryKey = 'appreciation_id';
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'title',
'alias',
'type',
'employee_id',
'appreciated_by',
'appreciated_date',
'status',
'description',
'remarks',
];
public $appends = ['status_name'];
public const APPRECIATION_TYPE = [
1 => 'Employee of the Month',
2 => 'Best Manager',
3 => 'Dedicated Employeer',
4 => 'Hard Working Employee',
];
public function appreciatee()
{
return $this->belongsTo(Employee::class, 'employee_id')->withDefault();
}
public function appreciator()
{
return $this->belongsTo(Employee::class, 'appreciated_by')->withDefault();
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\CasteFactory;
class Caste extends Model
{
use HasFactory;
protected $table = "tbl_castes";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\CityFactory;
class City extends Model
{
use HasFactory;
protected $table = "tbl_cities";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'district_id',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
}

View File

@@ -0,0 +1,39 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\CompanyFactory;
class Company extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_companies';
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'alias',
'company_type_id',
'address',
'bank_name',
'bank_acc_no',
'bank_acc_branch',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected $appends = ['status_name'];
protected function companyType()
{
return $this->belongsTo(CompanyType::class, 'company_type_id')->withDefault();
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\CompanyTypeFactory;
class CompanyType extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_company_types';
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'alias',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected $appends = ['status_name'];
}

View File

@@ -0,0 +1,45 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Notifications\Notifiable;
use Modules\Admin\Database\factories\ComplaintFactory;
use Modules\Employee\Models\Employee;
class Complaint extends Model
{
use HasFactory, Notifiable, StatusTrait;
protected $table = 'tbl_complaints';
protected $primaryKey = 'complaint_id';
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'complaint_id',
'employee_id',
'complaint_date',
'complaint_by',
'description',
'remarks',
'status',
'createdBy',
'updatedBy',
];
public $appends = ['status_name'];
public function respondent()
{
return $this->belongsTo(Employee::class, 'employee_id')->withDefault();
}
public function complainant()
{
return $this->belongsTo(Employee::class, 'complaint_by')->withDefault();
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\CountryFactory;
class Country extends Model
{
use HasFactory, StatusTrait;
protected $table = "tbl_countries";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected $appends = ['status_name'];
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Modules\Employee\Models\Employee;
class Department extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_departments';
protected $primaryKey = 'department_id';
protected $fillable = [
'name',
'department_head',
'status',
'description',
'remarks',
'createdBy',
'updatedBy'
];
protected $appends = ['status_name'];
public function departmentHead()
{
return $this->belongsTo(Employee::class, 'employee_id')->withDefault();
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Designation extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_designations';
protected $primaryKey = 'designation_id';
protected $fillable = [
'name',
'department_id',
'status',
'description',
'remarks',
'createdBy',
'updatedBy'
];
protected $appends = ['status_name'];
public function department()
{
return $this->belongsTo(Department::class, 'department_id')->withDefault();
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\DistrictFactory;
class District extends Model
{
use HasFactory;
protected $table = "tbl_districts";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'province_id',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected function province(){
return $this->belongsTo(Province::class,'province_id');
}
// protected function name(): Attribute
// {
// return Attribute::make(
// get: fn($value) => strtolower($value),
// );
// }
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Str;
class Dropdown extends Model
{
use StatusTrait;
protected $table = 'tbl_dropdowns';
protected $fillable = ['fid', 'title', 'alias', 'status'];
protected $appends = ['status_name'];
protected static function booted()
{
static::creating(function ($field) {
$field->alias = Str::slug($field->title);
});
static::updating(function ($field) {
$field->alias = Str::slug($field->title);
});
}
public function field()
{
return $this->belongsTo(Field::class, 'fid');
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\EthinicityFactory;
class Ethnicity extends Model
{
use HasFactory;
protected $table = "tbl_ethnicities";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
}

View File

@@ -0,0 +1,57 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\EventFactory;
class Event extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_events';
protected $primaryKey = "event_id";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'title',
'type',
'start_date',
'end_date',
'start_time',
'end_time',
'location',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected $casts = [
'start_date' => 'datetime',
'end_date' => 'datetime',
];
public const MEETING_TYPE = [
1 => 'Meeting',
2 => 'Training Sessions',
3 => 'Seminars',
4 => 'Celebrations',
5 => 'Product Launches',
6 => 'Wellness Events',
];
public $appends = ['status_name'];
public function getMeetingType()
{
return self::MEETING_TYPE[$this->type] ?? null;
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Str;
class Field extends Model
{
protected $table = 'tbl_fields';
protected $fillable = ['title', 'alias', 'status'];
protected static function booted()
{
static::creating(function ($field) {
$field->alias = Str::slug($field->title);
});
static::updating(function ($field) {
$field->alias = Str::slug($field->title);
});
}
public function dropdown()
{
return $this->hasMany(Dropdown::class, 'fid');
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\GenderFactory;
class Gender extends Model
{
use HasFactory;
protected $table = "tbl_genders";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\HolidayFactory;
class Holiday extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_holidays';
protected $primaryKey = "holiday_id";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'title',
'start_date',
'end_date',
'status',
'description',
'remarks',
'createdBy',
'updatedBy'
];
public $appends = ['status_name'];
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\MunicipalityFactory;
class Municipality extends Model
{
use HasFactory;
protected $table = "tbl_municipalities";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'distict_id',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected function district()
{
return $this->belongsTo(District::class, 'district_id');
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\NationalityFactory;
class Nationality extends Model
{
use HasFactory;
protected $table = "tbl_nationalities";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
}

View File

@@ -0,0 +1,22 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\ProgressStatusFactory;
class ProgressStatus extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*/
protected $fillable = [];
protected static function newFactory(): ProgressStatusFactory
{
//return ProgressStatusFactory::new();
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace Modules\Admin\Models;
use App\Observers\PromotionDemotionObserver;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Employee\Models\Employee;
#[ObservedBy([PromotionDemotionObserver::class])]
class PromotionDemotion extends Model
{
use HasFactory;
protected $table = "tbl_promotion_demotions";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'employee_id',
'title',
'type',
'old_designation_id',
'new_designation_id',
'status',
'description',
'remarks',
];
public function employee()
{
return $this->belongsTo(Employee::class, 'employee_id');
}
public function oldDesignation()
{
return $this->belongsTo(Designation::class, 'old_designation_id')->withDefault(['name' => '-']);
}
public function newDesignation()
{
return $this->belongsTo(Designation::class, 'new_designation_id')->withDefault(['name' => '-']);
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Modules\Admin\Database\factories\ProvinceFactory;
class Province extends Model
{
use HasFactory;
protected $table = "tbl_provinces";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'country_id',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected function country()
{
return $this->belongsTo(Country::class, 'country_id');
}
}

View File

@@ -0,0 +1,59 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\ResignationFactory;
use Modules\Employee\Models\Employee;
class Resignation extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_resignations';
protected $primaryKey = 'resignation_id';
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'employee_id',
'resignation_date',
'resignation_type',
'progress_status_id',
'approved_date',
'approved_by',
'description',
'remarks',
'status',
'createdBy',
'updatedBy',
];
public $appends = ['status_name'];
public const RESIGNATION_TYPE = [
1 =>'Voluntary',
2=> 'Involuntary',
3=> 'Retirement',
];
public const PROGRESS_STATUS = [
1 => 'Pending',
2 => 'Approved',
3 => 'Rejected',
];
public function resigner()
{
return $this->belongsTo(Employee::class, 'employee_id')->withDefault();
}
public function approver()
{
return $this->belongsTo(Employee::class, 'approved_by')->withDefault();
}
}

View File

@@ -0,0 +1,68 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Employee\Models\Employee;
class Transfer extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_transfers';
protected $primaryKey = 'transfer_id';
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'employee_id',
'old_department_id',
'new_department_id',
'status',
'transfer_date',
'transfer_type',
'progress_status_id',
'approved_by',
'approved_date',
'description',
'remarks',
'createdBy',
'updatedBy',
];
public $appends = ['status_name'];
public const PROGRESS_STATUS = [
1 => 'Pending',
2 => 'Approved',
3 => 'Rejected',
];
public const TRANSFER_TYPE = [
1 => 'Internal',
2 => 'External',
3 => 'Temporary',
];
public function oldDepartment()
{
return $this->belongsTo(Department::class, 'old_department_id')->withDefault();
}
public function newDepartment()
{
return $this->belongsTo(Department::class, 'new_department_id')->withDefault();
}
public function employee()
{
return $this->belongsTo(Employee::class, 'employee_id')->withDefault();
}
public function approver()
{
return $this->belongsTo(Employee::class, 'approved_by')->withDefault();
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace Modules\Admin\Models;
use App\Observers\WarningObserver;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Employee\Models\Employee;
#[ObservedBy([WarningObserver::class])]
class Warning extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_warnings';
protected $primaryKey = 'warning_id';
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'employee_id',
'type',
'reason',
'warning_date',
'description',
'remarks',
'status',
'createdBy',
'updatedBy',
];
public $appends = ['status_name'];
public const WARNING_TYPE = [
1 => 'Verbal Warning',
2 => 'Written Warning',
3 => 'Suspension',
4 => 'Termination Notice',
];
public const WARNING_REASON = [
1 => 'Performance Issues',
2 => 'Attendance Problems',
3 => 'Policy Violations',
4 => 'Customer Complaints',
5 => 'Interpersonal Issues',
6 => 'Behavioral Concerns',
];
public function warningRecipient()
{
return $this->belongsTo(Employee::class, 'employee_id')->withDefault();
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\WorkShiftFactory;
class WorkShift extends Model
{
use HasFactory;
protected $table = "tbl_work_shifts";
protected $primaryKey = "work_shift_id";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [];
}