Merge branch 'bryam' of https://github.com/BryamE/ProyectoLauck into giane
This commit is contained in:
+16
-9
@@ -8,16 +8,24 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Product extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'codigo',
|
||||
'nombre',
|
||||
'costo',
|
||||
'precio',
|
||||
'stock',
|
||||
'min_stock',
|
||||
'categoria',
|
||||
'descripcion'
|
||||
'name',
|
||||
'sku',
|
||||
'description',
|
||||
'price',
|
||||
'cost',
|
||||
'stock_quantity',
|
||||
'min_stock_alert',
|
||||
'type',
|
||||
'serial_number'
|
||||
];
|
||||
|
||||
public function hasLowStock(): bool
|
||||
{
|
||||
return $this->stock_quantity <= $this->min_stock_alert;
|
||||
}
|
||||
|
||||
public function supplier()
|
||||
{
|
||||
return $this->belongsTo(Suppliers::class);
|
||||
@@ -36,7 +44,6 @@ class Product extends Model
|
||||
{
|
||||
return $this->belongsToMany(Sale::class, 'sale_details');
|
||||
}
|
||||
|
||||
}
|
||||
/**$user->sales: Te da la lista de todas las compras de ese usuario.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user