MUCHOS CAMBIOS (IMPORTANTES)
This commit is contained in:
@@ -48,6 +48,7 @@ class ProductFactory extends Factory
|
||||
'type' => $type,
|
||||
// Nro de serie si es bicicleta
|
||||
'serial_number' => $type === 'bike' ? strtoupper($this->faker->bothify('##??##??')) : null,
|
||||
'suppliers_id'=> 1
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,12 +21,12 @@ return new class extends Migration
|
||||
$table->decimal('cost', 10, 2)->nullable(); // Costo (solo admin)
|
||||
|
||||
$table->integer('stock_quantity')->default(0);
|
||||
$table->integer('min_stock_alert')->default(5); // Alerta
|
||||
$table->integer('min_stock_alert'); // Alerta
|
||||
|
||||
$table->enum('type', ['bike', 'accessory', 'service']);
|
||||
$table->string('serial_number')->nullable(); // Solo para bicis
|
||||
|
||||
$table->foreignId('suppliers_id')->constrained();
|
||||
$table->foreignId('suppliers_id')->constrained()->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->string('image_path')->nullable()->after('type');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropColumn('image_path');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -6,6 +6,7 @@ use Illuminate\Database\Seeder;
|
||||
use App\Models\User;
|
||||
use App\Models\Product;
|
||||
use App\Models\Client;
|
||||
use App\Models\Supplier;
|
||||
use App\Models\Appointment;
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
|
||||
@@ -29,6 +30,12 @@ class DatabaseSeeder extends Seeder
|
||||
'role' => 'employee',
|
||||
]);
|
||||
|
||||
Supplier::create([
|
||||
'name' => 'Cámara 29 Válvula Auto',
|
||||
'phone' => '3434567890',
|
||||
'email' => 'suplier@suplier.com'
|
||||
]);
|
||||
|
||||
//Crear Productos
|
||||
Product::create([
|
||||
'name' => 'Cámara 29 Válvula Auto',
|
||||
@@ -37,7 +44,8 @@ class DatabaseSeeder extends Seeder
|
||||
'cost' => 2500,
|
||||
'stock_quantity' => 20,
|
||||
'min_stock_alert' => 5,
|
||||
'type' => 'accessory'
|
||||
'type' => 'accessory',
|
||||
'suppliers_id' => 1
|
||||
]);
|
||||
|
||||
Product::create([
|
||||
@@ -48,7 +56,8 @@ class DatabaseSeeder extends Seeder
|
||||
'stock_quantity' => 2,
|
||||
'min_stock_alert' => 1,
|
||||
'type' => 'bike',
|
||||
'serial_number' => 'VZ998877'
|
||||
'serial_number' => 'VZ998877',
|
||||
'suppliers_id' => 1
|
||||
]);
|
||||
|
||||
// Generar 10 productos aleatorios más
|
||||
|
||||
Reference in New Issue
Block a user