ldc-boutique-cnc-sable/app/Models/Stat.php

40 lines
926 B
PHP
Raw Permalink Normal View History

2020-11-17 13:41:31 +01:00
<?php
2026-06-14 21:32:07 +02:00
declare(strict_types=1);
2020-11-17 13:41:31 +01:00
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
2026-06-14 21:32:07 +02:00
use Illuminate\Database\Eloquent\Relations\BelongsTo;
2020-11-17 13:41:31 +01:00
2026-06-14 21:32:07 +02:00
/**
* @property int $id
* @property string $product_id
* @property \Illuminate\Support\Carbon $date
* @property float $margin
* @property int $nb_sale
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \App\Models\Product|null $product
*
* @mixin \Eloquent
*/
class Stat extends Model
2020-11-17 13:41:31 +01:00
{
2026-06-14 21:32:07 +02:00
/** @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\Product,$this> */
public function product(): BelongsTo
{
return $this->belongsTo(Product::class);
}
2020-11-17 13:41:31 +01:00
2026-06-14 21:32:07 +02:00
#[\Override]
protected function casts(): array
2022-09-08 11:29:39 +02:00
{
2026-06-14 21:32:07 +02:00
return [
'date' => 'datetime',
'margin' => 'float',
'nb_sale' => 'int',
];
2020-11-17 13:41:31 +01:00
}
}