temp(diag): add /__wo-diag/{id} route to inspect prod state
Returns tenant context, WO visibility via scope, and the current dashboard button URL that Filament's Page::getUrl() produces. Will be removed once the bug is diagnosed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,26 @@ use App\Tenancy\TenantManager;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
Route::get('/__wo-diag/{id}', function ($id) {
|
||||||
|
$wo = \App\Models\Tenant\WorkOrder::withoutGlobalScopes()->find((int) $id);
|
||||||
|
$tenant = app(TenantManager::class)->current();
|
||||||
|
$scopedWo = \App\Models\Tenant\WorkOrder::find((int) $id);
|
||||||
|
$btnUrl = \App\Filament\Tenant\Pages\WorkOrderDashboard::getUrl(['record' => (int) $id]);
|
||||||
|
$file = base_path('app/Filament/Tenant/Resources/WorkOrderResource/Pages/EditWorkOrder.php');
|
||||||
|
$codeSnip = str_contains(file_get_contents($file), 'WorkOrderDashboard::getUrl') ? 'NEW code deployed' : 'OLD code — deploy not applied';
|
||||||
|
return response()->json([
|
||||||
|
'requested_id' => (int) $id,
|
||||||
|
'tenant_slug' => $tenant?->slug,
|
||||||
|
'tenant_id' => $tenant?->id,
|
||||||
|
'wo_exists_globally' => $wo !== null,
|
||||||
|
'wo_belongs_to_tenant' => $wo && $tenant && $wo->company_id === $tenant->id,
|
||||||
|
'wo_visible_via_scope' => $scopedWo !== null,
|
||||||
|
'wo_actual_company_id' => $wo?->company_id,
|
||||||
|
'dashboard_button_url' => $btnUrl,
|
||||||
|
'edit_file_status' => $codeSnip,
|
||||||
|
], 200, ['Content-Type' => 'application/json']);
|
||||||
|
});
|
||||||
|
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
// On a tenant subdomain → public landing page.
|
// On a tenant subdomain → public landing page.
|
||||||
$tenant = app(TenantManager::class)->current();
|
$tenant = app(TenantManager::class)->current();
|
||||||
|
|||||||
Reference in New Issue
Block a user