first commit
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Verifikator;
|
||||
|
||||
use App\Models\DokSiremun\CatatanPengajuan;
|
||||
use App\Models\DokSiremun\LogPengajuan;
|
||||
use App\Models\Verifikator\View\Pegawai;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class JabatanPegawai extends Model
|
||||
{
|
||||
protected $table = 'verifikator.jabatan_pegawais';
|
||||
protected $guarded = [];
|
||||
|
||||
function getSkJabatanFungsionalAttribute($value): string | null
|
||||
{
|
||||
if (!$value) return null;
|
||||
if (str_starts_with($value, 'http')) return $value;
|
||||
return "https://" . request()->getHost() . "/storage/jabatan/fungsional/$value";
|
||||
}
|
||||
|
||||
function getSkJabatanTambahanAttribute($value): string | null
|
||||
{
|
||||
if (!$value) return null;
|
||||
if (str_starts_with($value, 'http')) return $value;
|
||||
return "https://" . request()->getHost() . "/storage/jabatan/tambahan/$value";
|
||||
}
|
||||
|
||||
function pegawai()
|
||||
{
|
||||
return $this->belongsTo(Pegawai::class, 'nip', 'nip');
|
||||
}
|
||||
|
||||
function detail()
|
||||
{
|
||||
return $this->hasMany(JabatanPegawaiDetail::class);
|
||||
}
|
||||
|
||||
function logs()
|
||||
{
|
||||
return $this->morphMany(LogPengajuan::class, 'logable');
|
||||
}
|
||||
|
||||
function notes()
|
||||
{
|
||||
return $this->morphMany(CatatanPengajuan::class, 'noteable');
|
||||
}
|
||||
|
||||
function scopeActive($query)
|
||||
{
|
||||
return $query->where('active', true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user