Add a flag to skip database connection
Summary
Supporting vite-plugin-wayfinder PR
wayfinder:generate looks up route model binding types from the database schema. In private cloud build environments the database is not reachable, and Laravel retries the connection after it times out. Each distinct model therefore blocks for twice the connection timeout. A generate that should take about a minute can hang for more than 30 minutes.
This adds a --model-docblocks option. When it is set, binding types are read from the Eloquent model's @property docblocks and the schema query is skipped, so generation never opens a database connection. Without the flag, behavior is unchanged: Wayfinder still queries the schema and falls back to the docblock only if that query throws.
php artisan wayfinder:generate --model-docblocks
The flag is applied before both actions and named routes are written, so actions/ and routes/ stay consistent. --skip-actions and --skip-routes are unaffected.
Test plan
- Generate without the flag against a model whose
idcolumn is an integer and confirm the parameter type isnumber - Generate again with
--model-docblocksfor a model whose docblock says@property string $idand confirm the parameter type isstring - Run
vendor/bin/phpunit