refactor(schema-modernization): phase A follow-ups (8.2, 8.5, 8.8)
8.2 FlightForm::resolveParentBundle — drop 3 speculative route param
names (bundle, flightBundle, record), keep only canonical flight_bundle.
Verified via route:list — admin/flights/{flight_bundle}/flight/...
8.5 FlightsNavigationTest — replace ReflectionClass with Filament public
API (getParentResource). Added getParentResourceRegistration assertion
to prove nav suppression (HasNavigation::registerNavigationItems skips
when parent registration present). shouldRegisterNavigation stays true
by default — wrong API for this check.
8.8 composer.json — register pint + pint:test scripts so AGENTS.md
pre-PR checklist works.
This commit is contained in:
parent
28f49b97c3
commit
0023118383
@ -242,17 +242,15 @@ class FlightForm
|
||||
// Fall back to route resolution (works on create page + production requests).
|
||||
$route = request()->route();
|
||||
if ($route !== null) {
|
||||
foreach (['bundle', 'flightBundle', 'flight_bundle', 'record'] as $param) {
|
||||
$value = $route->parameter($param);
|
||||
if ($value instanceof FlightBundle) {
|
||||
return $value;
|
||||
}
|
||||
$value = $route->parameter('flight_bundle');
|
||||
if ($value instanceof FlightBundle) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (is_scalar($value)) {
|
||||
$found = FlightBundle::query()->find($value);
|
||||
if ($found instanceof FlightBundle) {
|
||||
return $found;
|
||||
}
|
||||
if (is_scalar($value)) {
|
||||
$found = FlightBundle::query()->find($value);
|
||||
if ($found instanceof FlightBundle) {
|
||||
return $found;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,6 +174,8 @@
|
||||
"npx npm-check-updates -u -t minor && npm install"
|
||||
],
|
||||
"lint": "pint --parallel",
|
||||
"pint": "pint",
|
||||
"pint:test": "pint --test",
|
||||
"refactor": "rector",
|
||||
"test:lint": "pint --test --parallel",
|
||||
"test:refactor": "rector --dry-run",
|
||||
|
||||
@ -28,10 +28,14 @@ it('registers exactly one Flights navigation entry pointing to /admin/flights',
|
||||
->toBe(__('filament.flights.navigation_label'));
|
||||
|
||||
// FlightResource is nested under FlightBundleResource — no standalone nav entry.
|
||||
$parentResource = (new ReflectionClass(FlightResource::class))->getStaticPropertyValue('parentResource');
|
||||
expect($parentResource)
|
||||
expect(FlightResource::getParentResource())
|
||||
->toBe(FlightBundleResource::class);
|
||||
|
||||
// Parent registration is the mechanism Filament uses to skip nav for nested resources
|
||||
// (see Filament\Resources\Resource\Concerns\HasNavigation::registerNavigationItems).
|
||||
expect(FlightResource::getParentResourceRegistration())
|
||||
->not->toBeNull();
|
||||
|
||||
// Slug confirms URL ends with /admin/flights.
|
||||
expect(FlightBundleResource::getSlug())
|
||||
->toBe('flights');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user