29 lines
528 B
PHP
29 lines
528 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
class WeightLog extends Model
|
||
|
|
{
|
||
|
|
use HasFactory;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'user_id',
|
||
|
|
'weight_kg',
|
||
|
|
'logged_at',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'weight_kg' => 'decimal:2',
|
||
|
|
'logged_at' => 'date',
|
||
|
|
];
|
||
|
|
|
||
|
|
public function user(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(User::class);
|
||
|
|
}
|
||
|
|
}
|