<?php


namespace App\Models\StockManagement\Traits;


use App\Models\StockManagement\Stock;

trait HasStocks{

    public function stock(){
        return $this->belongsTo(Stock::class,Stock::FK_ID);
    }

    //les stocks ordonnés par date d'expiration
    public function stocks(){
        return $this->hasMany(Stock::class,Stock::FK_ID)
                    ->orderBy('expired_at','asc');
    }

}
