2026-02-08 15:16:35 +07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
|
|
class WeightHistory extends Model
|
|
|
|
|
{
|
2026-09-23 12:45:02 +07:00
|
|
|
// Pastikan fillable sesuai dengan kolom di database
|
|
|
|
|
protected $fillable = [
|
|
|
|
|
'cat_id',
|
|
|
|
|
'berat',
|
|
|
|
|
'tanggal_timbang', // Pastikan baris ini ada
|
|
|
|
|
'created_at',
|
|
|
|
|
'updated_at'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected function casts(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'tanggal_timbang' => 'date',
|
|
|
|
|
'berat' => 'decimal:2',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function cat()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Cat::class);
|
|
|
|
|
}
|
|
|
|
|
}
|