StocksNew/Modules/Recruit/app/Models/JobPost.php
Sampanna Rimal 53c0140f58 first commit
2024-08-27 17:48:06 +05:45

70 lines
1.5 KiB
PHP

<?php
namespace Modules\Recruit\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Models\Department;
use Modules\Admin\Models\Departments;
use Modules\Admin\Models\Designation;
use Modules\Admin\Models\Designations;
use Modules\Employee\Models\Employee;
use Modules\Recruit\Database\factories\JobPostFactory;
class JobPost extends Model
{
use StatusTrait;
protected $table = 'tbl_job_posts';
protected $primaryKey = 'job_post_id';
use HasFactory;
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'title',
'alias',
'vacancy_no',
'department_id',
'designation_id',
'post_date',
'expiry_date',
'status',
'description',
'remarks',
'createdBy',
'updateBy',
];
public $appends = ['status_name'];
public function department()
{
return $this->belongsTo(Department::class, 'department_id');
}
public function designation()
{
return $this->belongsTo(Designation::class, 'designation_id');
}
public function jobPoster()
{
return $this->belongsTo(Employee::class, 'createdBy');
}
public function interviewSchedules()
{
return $this->hasMany(InterviewSchedule::class, 'job_post_id');
}
public function jobApplications()
{
return $this->hasMany(JobApplication::class, 'job_post_id');
}
}