/home/mip/mip/app/Modules/Client/Models/Applicants/Applicant.php
<?php

namespace QxCMS\Modules\Client\Models\Applicants;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

class Applicant extends Model
{
    protected $connection = 'client';
    protected $table = 'applicants';
    public $module_id = 19;
    
    protected $guarded = [];
    protected $appends = ['hashid', 'full_name'];

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function getFullNameAttribute()
    {
        return ucwords(strtolower($this->first_name.' '.(($this->middle_name != "") ?  $this->middle_name. ' ':'').$this->last_name));
    }

    public function jobs()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Applicants\JobApplied', 'applicant_id');
    }

    public function latestJob()
    {
        return $this->hasOne('QxCMS\Modules\Client\Models\Applicants\JobApplied', 'applicant_id')->latest();
    }
}