id(); $table->string('bookingnumber'); $table->unsignedBigInteger('client_id'); $table->unsignedBigInteger('employee_id'); $table->unsignedBigInteger('service_id'); $table->date('bookingdate'); $table->time('starttime'); $table->time('endtime'); $table->enum('status', ['confirmed', 'cancelled', 'completed'])->default('confirmed'); $table->enum('cancelledby', ['client', 'admin'])->nullable(); $table->text('cancelreason')->nullable(); $table->timestamps(); // Внешние ключи $table->foreign('client_id')->references('id')->on('users'); $table->foreign('employee_id')->references('id')->on('users'); $table->foreign('service_id')->references('id')->on('services'); // УНИКАЛЬНЫЙ ИНДЕКС $table->unique(['employee_id', 'bookingdate', 'starttime'], 'unique_booking_slot'); }); } public function down() { Schema::dropIfExists('bookings'); } };