<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Jadwal extends Model
{
use HasFactory;
protected $guarded = [];
public function user() {
return $this->belongsTo(User::class);
}
public function kegiatan_harian() {
return $this->belongsTo(KegiatanHarian::class);
}
public function petugas() {
return $this->belongsTo(Petugas::class);
}
public function target_capaian() {
return $this->hasMany(TargetCapaian::class);
}
public function targetCapaianLatest() {
return $this->hasOne(TargetCapaian::class, 'jadwal_id')
->where('is_alarm', 1) // hanya ambil yang is_alarm = 1
->latestOfMany();
}
}
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]