diff --git a/app/Http/Controllers/ProductosController.php b/app/Http/Controllers/ProductosController.php
index d288937..76fb067 100644
--- a/app/Http/Controllers/ProductosController.php
+++ b/app/Http/Controllers/ProductosController.php
@@ -73,28 +73,28 @@ class ProductosController extends Controller
* Muestra el detalle de un producto.
* Usamos Route Model Binding: Laravel busca el ID solo.
*/
- public function show(Product $producto)
+ public function show(Product $product)
{
- return view('productos.show', compact('producto'));
+ return view('productos.show', compact('product'));
}
/**
* Muestra el formulario de edición.
*/
- public function edit(Product $producto)
+ public function edit(Product $product)
{
- return view('productos.edit', compact('producto'));
+ return view('productos.edit', compact('product'));
}
/**
* Actualiza el producto existente.
*/
- public function update(Request $request, Product $producto)
+ public function update(Request $request, Product $product)
{
$validated = $request->validate([
'name' => 'required|string|max:255',
// Validamos que el SKU sea único PERO ignoramos el ID de este producto actual
- 'sku' => ['nullable', 'string', Rule::unique('products')->ignore($producto->id)],
+ 'sku' => ['nullable', 'string', Rule::unique('products')->ignore($product->id)],
'description' => 'nullable|string',
'price' => 'required|numeric|min:0',
'cost' => 'nullable|numeric|min:0',
@@ -104,7 +104,7 @@ class ProductosController extends Controller
'serial_number' => 'nullable|string|max:100',
]);
- $producto->update($validated);
+ $product->update($validated);
return redirect()->route('productos.index')
->with('success', 'Producto actualizado exitosamente.');
@@ -113,9 +113,9 @@ class ProductosController extends Controller
/**
* Elimina el producto.
*/
- public function destroy(Product $producto)
+ public function destroy(Product $product)
{
- $producto->delete();
+ $product->delete();
return redirect()->route('productos.index')
->with('success', 'Producto eliminado.');
}
diff --git a/app/Http/Controllers/SaleController.php b/app/Http/Controllers/SaleController.php
index b954b1a..8e8a7f7 100644
--- a/app/Http/Controllers/SaleController.php
+++ b/app/Http/Controllers/SaleController.php
@@ -59,8 +59,8 @@ class SaleController extends Controller
SaleDetail::create([
'sale_id' => $sale->id,
'product_id' => $product->id,
- 'cantidad' => $item['quantity'],
- 'precio' => $product->price,
+ 'quantity' => $item['quantity'],
+ 'price' => $product->price,
]);
$nuevoStock = $product->stock_quantity - $item['quantity'];
$product->stock_quantity = $nuevoStock;
diff --git a/app/Models/Product.php b/app/Models/Product.php
index 25d29cf..f9ce056 100644
--- a/app/Models/Product.php
+++ b/app/Models/Product.php
@@ -13,13 +13,12 @@ class Product extends Model
public function hasLowStock(): bool
{
- //cambiar
return $this->stock_quantity <= $this->min_stock_alert;
}
public function supplier()
{
- return $this->belongsTo(Suppliers::class);
+ return $this->belongsTo(Supplier::class);
}
// Opción 1: Relación directa con los detalles (Renglones de ticket)
diff --git a/app/Models/Supplier.php b/app/Models/Supplier.php
index 8acf047..c72f08a 100644
--- a/app/Models/Supplier.php
+++ b/app/Models/Supplier.php
@@ -6,11 +6,8 @@ use Illuminate\Database\Eloquent\Model;
class Supplier extends Model
{
- protected $fillable = [
- 'nombre',
- 'telefono',
- 'email'
- ];
+ protected $fillable = [ 'name', 'phone', 'email' ];
+
public function products()
{
return $this->hasMany(Product::class);
diff --git a/app/View/Components/Alert2.php b/app/View/Components/Alert2.php
deleted file mode 100644
index bf1d9bb..0000000
--- a/app/View/Components/Alert2.php
+++ /dev/null
@@ -1,40 +0,0 @@
-class = $class;
- }
-
- //* Get the view / contents that represent the component.
- public function render(): View|Closure|string
- {
- return view('components.alert2');
- }
-}
diff --git a/database/migrations/2025_12_06_182356_create_suppliers_table.php b/database/migrations/2025_12_06_182356_create_suppliers_table.php
index c5e0c12..ed43605 100644
--- a/database/migrations/2025_12_06_182356_create_suppliers_table.php
+++ b/database/migrations/2025_12_06_182356_create_suppliers_table.php
@@ -13,8 +13,8 @@ return new class extends Migration
{
Schema::create('suppliers', function (Blueprint $table) {
$table->id();
- $table->string('nombre');
- $table->string('telefono');
+ $table->string('name');
+ $table->string('phone');
$table->string('email');
$table->timestamps();
});
diff --git a/database/migrations/2025_12_06_184833_create_clients_table.php b/database/migrations/2025_12_06_184833_create_clients_table.php
deleted file mode 100644
index 398e55b..0000000
--- a/database/migrations/2025_12_06_184833_create_clients_table.php
+++ /dev/null
@@ -1,30 +0,0 @@
-id();
- $table->string('nombre');
- $table->string('telefono');
- $table->string('email');
- $table->timestamps();
- });
- }
-
- /**
- * Reverse the migrations.
- */
- public function down(): void
- {
- Schema::dropIfExists('clients');
- }
-};
diff --git a/database/migrations/2025_12_06_201853_create_sale_details_table.php b/database/migrations/2025_12_06_201853_create_sale_details_table.php
index e357fa9..3e0818a 100644
--- a/database/migrations/2025_12_06_201853_create_sale_details_table.php
+++ b/database/migrations/2025_12_06_201853_create_sale_details_table.php
@@ -15,8 +15,8 @@ return new class extends Migration
$table->id();
$table->foreignId('sale_id')->constrained()->onDelete('cascade');
$table->foreignId('product_id')->constrained();
- $table->integer('cantidad');
- $table->decimal('precio', 10, 2);
+ $table->integer('quantity');
+ $table->decimal('price', 10, 2);
$table->timestamps();
});
}
diff --git a/database/migrations/2025_12_07_023045_create_appointments_table.php b/database/migrations/2025_12_07_023045_create_appointments_table.php
deleted file mode 100644
index 3bac73b..0000000
--- a/database/migrations/2025_12_07_023045_create_appointments_table.php
+++ /dev/null
@@ -1,33 +0,0 @@
-id();
- $table->foreignId('client_id')->constrained();
- $table->datetime('fecha_programada');
- $table->string('modelo_bici')->nullable();
- $table->string('descripcion')->nullable();
- $table->string('estado')->default('pendiente');
- $table->string('notas')->nullable();
- $table->timestamps();
- });
- }
-
- /**
- * Reverse the migrations.
- */
- public function down(): void
- {
- Schema::dropIfExists('appointments');
- }
-};
diff --git a/resources/views/productos/show.blade.php b/resources/views/productos/show.blade.php
index 71bb8b7..b74c74f 100644
--- a/resources/views/productos/show.blade.php
+++ b/resources/views/productos/show.blade.php
@@ -47,10 +47,4 @@
-
-
- {{-- componente alerta --}}
- {{--