<?php
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$request = Illuminate\Http\Request::create('/api/admin/settings', 'POST', [], [], [], [
    'CONTENT_TYPE' => 'application/json',
    'HTTP_X_TENANT_TOKEN' => \App\Models\Tenant::first()->auth_token ?? 'none',
], json_encode(['homePageJson' => '{"theme":"02"}', 'siteName' => 'Test Site']));

$response = $kernel->handle($request);
echo $response->getContent() . "\n";
$tenant = \App\Models\Tenant::first();
if ($tenant) {
    echo "DB: " . \App\Models\SiteSetting::where('tenant_id', $tenant->id)->first()->home_page_json . "\n";
}
