84 lines
2.3 KiB
PHP
84 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
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;
|
|
|
|
class DatabaseSeeder extends Seeder
|
|
{
|
|
public function run(): void
|
|
{
|
|
//Crear el Super Admin
|
|
User::factory()->create([
|
|
'name' => 'Sergio Lauck',
|
|
'email' => 'admin@lauck.com',
|
|
'password' => bcrypt('password'), // Cambiar en producción
|
|
'role' => 'admin',
|
|
]);
|
|
|
|
//Crear un Empleado de prueba
|
|
User::factory()->create([
|
|
'name' => 'Empleado Test',
|
|
'email' => 'taller@lauck.com',
|
|
'password' => bcrypt('password'),
|
|
'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',
|
|
'sku' => 'CAM-29-A',
|
|
'price' => 5000,
|
|
'cost' => 2500,
|
|
'stock_quantity' => 20,
|
|
'min_stock_alert' => 5,
|
|
'type' => 'accessory',
|
|
'suppliers_id' => 1
|
|
]);
|
|
|
|
Product::create([
|
|
'name' => 'Venzo Loki Evo 29',
|
|
'sku' => 'BIC-VEN-001',
|
|
'price' => 450000,
|
|
'cost' => 300000,
|
|
'stock_quantity' => 2,
|
|
'min_stock_alert' => 1,
|
|
'type' => 'bike',
|
|
'serial_number' => 'VZ998877',
|
|
'suppliers_id' => 1
|
|
]);
|
|
|
|
// Generar 50 productos aleatorios más
|
|
Product::factory(50)->create();
|
|
|
|
// Clientes y Turnos
|
|
$client = Client::create([
|
|
'name' => 'Juan Perez',
|
|
'phone' => '1122334455',
|
|
'email' => 'juan@gmail.com'
|
|
]);
|
|
|
|
Appointment::create([
|
|
'client_id' => $client->id,
|
|
'scheduled_at' => now()->addDays(1)->setHour(10)->setMinute(0),
|
|
'bike_model' => 'Trek Marlin 5',
|
|
'problem_description' => 'Service completo y ajuste de cambios',
|
|
'status' => 'pending'
|
|
]);
|
|
|
|
$this->call(ProductSeeder::class);
|
|
}
|
|
}
|