first commit
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Verifikator;
|
||||
|
||||
use App\Models\DokSiremun\Kegiatan;
|
||||
use App\Models\DokSiremun\LogPengajuan;
|
||||
use App\Models\DokSiremun\UnitKerja;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Sk extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
protected $table = 'verifikator.sks';
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'id_sk',
|
||||
'periode',
|
||||
'id_unit',
|
||||
'id_unit_siska',
|
||||
'id_unit_penandatangan',
|
||||
'id_pimpinan',
|
||||
'no_sk',
|
||||
'tanggal',
|
||||
'tentang',
|
||||
'verif_verifikator',
|
||||
'finalisasi',
|
||||
'must_fix',
|
||||
'sk_jadi',
|
||||
'cost',
|
||||
'visible',
|
||||
];
|
||||
|
||||
function unit()
|
||||
{
|
||||
return $this->belongsTo(UnitKerja::class, 'id_unit');
|
||||
}
|
||||
|
||||
function logs()
|
||||
{
|
||||
return $this->morphMany(LogPengajuan::class, 'logable');
|
||||
}
|
||||
|
||||
function kegiatan()
|
||||
{
|
||||
return $this->hasOne(Kegiatan::class, 'id_sk');
|
||||
}
|
||||
|
||||
function iku()
|
||||
{
|
||||
return $this->hasOne(SkIku::class);
|
||||
}
|
||||
|
||||
function ikus()
|
||||
{
|
||||
return $this->hasMany(SkIku::class, 'sk_id', 'id');
|
||||
}
|
||||
|
||||
function anggota()
|
||||
{
|
||||
return $this->hasMany(AnggotaSk::class, 'id_sk_verifikator', 'id');
|
||||
}
|
||||
|
||||
function getSkJadiAttribute()
|
||||
{
|
||||
$unit = $this->unit->nama;
|
||||
if (str_starts_with($this->sk_jadi, 'http')) {
|
||||
return $this->sk_jadi;
|
||||
}
|
||||
return "https://siska.untan.ac.id/storage/sk/$unit/$this->sk_jadi";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user