45 lines
1005 B
PHP
45 lines
1005 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Product extends Model
|
|
{
|
|
protected $fillable = [
|
|
'nom',
|
|
'reference',
|
|
'categorie',
|
|
'fabricant',
|
|
'stock_actuel',
|
|
'stock_minimum',
|
|
'unite',
|
|
'prix_unitaire',
|
|
'date_expiration',
|
|
'numero_lot',
|
|
'conditionnement_nom',
|
|
'conditionnement_quantite',
|
|
'conditionnement_unite',
|
|
'photo_url',
|
|
'fiche_technique_url',
|
|
'fournisseur_id',
|
|
];
|
|
|
|
protected $casts = [
|
|
'stock_actuel' => 'decimal:2',
|
|
'stock_minimum' => 'decimal:2',
|
|
'prix_unitaire' => 'decimal:2',
|
|
'conditionnement_quantite' => 'decimal:2',
|
|
'date_expiration' => 'date',
|
|
];
|
|
|
|
/**
|
|
* Get the fournisseur that owns the product.
|
|
*/
|
|
public function fournisseur(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Fournisseur::class);
|
|
}
|
|
}
|