30 lines
1.5 KiB
PHP
30 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class NewFatLog extends BaseModel
|
|
{
|
|
use HasFactory;
|
|
protected $table = 'fat_log';
|
|
public const DESC_KET = ['Weight.1002', 'Weight.1003', 'Weight.1004', 'Weight.1005', 'Weight.1006', 'Bodyfat.1002', 'Bodyfat.1003', 'Bodyfat.1004', 'Bodyfat.1005', 'BMI.1002', 'BMI.1003', 'BMI.1004', 'BMI.1005', 'Bone.1002', 'Bone.1003', 'Bone.1004', 'HeartIndex.1002', 'HeartIndex.1003', 'HeartIndex.1004', 'HeartRate.1002', 'HeartRate.1003', 'HeartRate.1004', 'HeartRate.1005', 'HeartRate.1006', 'Muscle.1002', 'Muscle.1003', 'Muscle.1004', 'Sinew.1002', 'Sinew.1003', 'Sinew.1004', 'Protein.1002', 'Protein.1003', 'Protein.1004', 'Subfat.1002', 'Subfat.1003', 'Subfat.1004', 'Visfat.1002', 'Visfat.1003', 'Visfat.1004', 'Water.1002', 'Water.1003', 'Water.1004', 'Score.1002', 'Score.1003', 'Score.1004', 'Score.1005', 'LBM.1002', 'BodyAge.1002', 'BodyAge.1003', 'BMR.1002', 'BMR.1003', 'BodyShape.1002', 'BodyShape.1003', 'BodyShape.1004', 'BodyShape.1005', 'BodyShape.1006', 'BodyShape.1007', 'BodyShape.1008', 'BodyShape.1009', 'BodyShape.1010'];
|
|
|
|
const WEIGHT_RATE = 2.2;
|
|
const WEIGHT_JIN_LB_RATE = 1.1;
|
|
const WEIGHT_JIN_KG_RATE = 2;
|
|
|
|
const REDIS_MAX_MIN_KEY = 'max_min_data:';
|
|
|
|
public function fatKind()
|
|
{
|
|
return $this->hasOne(FatKind::class, 'fat_name', 'fat_name')->select('fat_name', 'icon', 'h_icon');
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, "user_id", "id");
|
|
}
|
|
}
|