Enth\u00e4lt gemischt: Laravel-10-Upgrade + Phase 1 (Contacts-Modul, Duplicats-Commands, Soft-Delete+Merge-Fields) + Phase 2 Code-Umstellungen (inquiry_id, $table='contacts'/'inquiries') + Offers-Modul (Migrationen, Models, offer_id in Booking, offer-Disk in filesystems.php). Phase 2 + Offers werden im folgenden Commit nach dev/backups/phase2-offers-2026-04-17/ verschoben, damit der Workspace auf Phase-1-only (= Test-System-Stand) reduziert ist und direkt auf Live deploybar wird. Tarball-Backup zus\u00e4tzlich unter: ../backups-safety/workspace-pre-phase1-rollback-2026-04-17.tar.gz Made-with: Cursor
44 lines
1.3 KiB
PHP
Executable file
44 lines
1.3 KiB
PHP
Executable file
<?php
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\TravelBooking;
|
|
use App\Services\BookingImport;
|
|
|
|
class BookingController extends Controller
|
|
{
|
|
private int $successStatus = 200;
|
|
private string $successKey;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->successKey = config('app.success_key');
|
|
}
|
|
|
|
public function import()
|
|
{
|
|
|
|
$request = \Request::all();
|
|
if (!isset($request['key']) || $request['key'] !== $this->successKey) {
|
|
return response()->json(['error' => "key"], 401);
|
|
}
|
|
$travel_booking = TravelBooking::find($request['travel_booking_id']);
|
|
|
|
if (!$travel_booking) {
|
|
return response()->json(['error' => 'no-booking-found'], $this->successStatus);
|
|
}
|
|
|
|
$booking = BookingImport::importFrom($travel_booking);
|
|
|
|
$ret = [
|
|
'url_v1' => make_old_url('/index.php/booking/' . $booking->id . '/edit'),
|
|
'url_v3' => route('booking_detail', $booking->id),
|
|
// API-Feld bleibt `lead_id` aus Abwärtskompatibilität für API-Konsumenten;
|
|
// Wert kommt nach Modul 3 Phase 2 aus booking.inquiry_id.
|
|
'lead_id' => $booking->inquiry_id
|
|
];
|
|
return response()->json(['success' => "import", "ret" => $ret], $this->successStatus);
|
|
|
|
}
|
|
}
|