fixed the health update

This commit is contained in:
ghassan committed 2026-01-22 12:17:43 +03:00
1 parent 59ad30575c
commit 36aea9a266
7 files changed
+861 -240

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class HealthRecord extends Model
{
use HasFactory;
protected $fillable = [
'user_id',
'recorded_at',
'weight',
'body_fat_percentage',
'bmi',
'body_water_percentage',
'muscle_mass',
'bone_mass',
'visceral_fat',
'bmr',
'protein_percentage',
'body_age',
];
protected $casts = [
'recorded_at' => 'date',
'weight' => 'decimal:2',
'body_fat_percentage' => 'decimal:2',
'bmi' => 'decimal:2',
'body_water_percentage' => 'decimal:2',
'muscle_mass' => 'decimal:2',
'bone_mass' => 'decimal:2',
'visceral_fat' => 'integer',
'bmr' => 'integer',
'protein_percentage' => 'decimal:2',
'body_age' => 'integer',
];
public function user()
{
return $this->belongsTo(User::class);
}
}
+8
View File
@@ -219,6 +219,14 @@ class User extends Authenticatable
return $this->hasMany(Invoice::class, 'payer_user_id');
}
/**
* Get the health records for the user.
*/
public function healthRecords(): HasMany
{
return $this->hasMany(HealthRecord::class);
}
/**
* Send the email verification notification.
* Override to prevent sending the default Laravel notification.