Add a flag to type bindings from model docblocks.
Summary
Depends on laravel/wayfinder#331.
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.
That pull request 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.
This exposes that flag as a modelDocblocks option on the Vite plugin. It defaults to false. When it is true, --model-docblocks is passed on every generate, including the initial build and hot reloads. --skip-actions and --skip-routes are unchanged.
wayfinder({
modelDocblocks: true,
})
Test plan
- Generate with the default options and confirm the artisan command does not include
--model-docblocks, and a model whoseidcolumn is an integer still types the parameter asnumber - Generate with
modelDocblocks: truefor a model whose docblock says@property string $idand confirm the command includes--model-docblocksand the parameter type isstring - Generate with
modelDocblocks: truealongsideactions: falseorroutes: falseand confirm--model-docblocksis still passed with--skip-actionsor--skip-routes