MIF_E31221305/TA_website/app/Models/Measurement.php

49 lines
1.0 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Measurement extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'customer_id',
'height',
'weight',
'shoulder',
'chest',
'waist',
'hip',
'sleeve',
'neck',
'notes'
];
protected $casts = [
'height' => 'decimal:2',
'weight' => 'decimal:2',
'shoulder' => 'decimal:2',
'chest' => 'decimal:2',
'waist' => 'decimal:2',
'hip' => 'decimal:2',
'sleeve' => 'decimal:2',
'neck' => 'decimal:2'
];
/**
* Get the customer that owns the measurement.
*/
public function customer(): BelongsTo
{
return $this->belongsTo(User::class, 'customer_id');
}
}