commit 12.01

This commit is contained in:
Владимир
2026-01-12 14:25:15 +00:00
parent 36084ba590
commit ae5ab2554b
26 changed files with 1116 additions and 1083 deletions

View File

@@ -2,24 +2,71 @@
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\User;
use App\Models\Service;
use App\Models\EmployeeAvailability;
use App\Models\Booking;
class DatabaseSeeder extends Seeder
{
use WithoutModelEvents;
/**
* Seed the application's database.
*/
public function run(): void
public function run()
{
// User::factory(10)->create();
// Создаём админа
User::create([
'name' => 'Админ',
'email' => 'admin@example.com',
'password' => bcrypt('123'),
'role' => 'admin'
]);
User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
// Создаём сотрудника
User::create([
'name' => 'Иван Петров',
'email' => 'ivan@example.com',
'password' => bcrypt('2001'),
'role' => 'employee'
]);
// Создаём клиента
User::create([
'name' => 'Мария Иванова',
'email' => 'maria@example.com',
'password' => bcrypt('2002'),
'role' => 'client'
]);
// Создаём услугу
Service::create([
'name' => 'Генеральная уборка',
'description' => 'Полная уборка помещения.',
'duration_minutes' => 180,
'price' => 5000.00,
'is_active' => true
]);
// Создаём расписание для сотрудника
EmployeeAvailability::create([
'employee_id' => 2, // Иван Петров
'date' => '2026-02-10',
'start_time' => '09:00:00',
'end_time' => '18:00:00',
'is_available' => true
]);
// Создаём бронирование
Booking::create([
'booking_number' => 'CL-2026-0001',
'client_id' => 3, // Мария Иванова
'employee_id' => 2, // Иван Петров
'service_id' => 1, // Генеральная уборка
'booking_date' => '2026-01-15',
'start_time' => '10:00:00',
'end_time' => '13:00:00',
'status' => 'confirmed'
]);
}
}
}