Laravel: find and fix N+1 queries
Eager loading fixes with proof.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1
Library / Coding & Technology / Database
New column/table with indexes, rollback and model updates.
Add a migration to [describe change, e.g. add a nullable "gst_number" to customers]. Requirements: - Create a NEW migration with php artisan make:migration; never edit existing migrations. - Provide a working down() method. - Add indexes for foreign keys and columns used in where/order clauses. - For large tables, avoid changes that lock the table for long; tell me if that's a risk. - Update the model ($fillable, casts, relationships) and the factory. - Add or update a feature test that uses the new column. Run php artisan migrate and php artisan test, and show the output.
Copies your prompt and opens the official site in a new tab. You may need to paste it yourself (Ctrl/⌘ + V). Nothing is sent to the AI by us.
Replace [bracketed] parts with your own details before sending. Want it tailored? Build a custom website & app development prompt.
A typical one-line request compared with this prompt. We only show sample responses where we've written an illustration.
Prompt
database
1 words · no role, context, format or constraints
Prompt
Add a migration to [describe change, e.g. add a nullable "gst_number" to customers]. Requirements: - Create a NEW migration with php artisan make:migration; never edit existing migrations. - Provide a working down() method. - Add indexes for foreign keys and columns used in where/order clauses. - For large tables, avoid changes that lock the table for long; tell me if that's a risk. - Update the model ($fillable, casts, relationships) and the factory. - Add or update a feature test that uses the new column. Run php artisan migrate and php artisan test, and show the output.
97 words · generated instantly from templates, no AI called
What we added
Eager loading fixes with proof.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1
Thin controllers with proper authorisation.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1
Idempotent jobs with retries and tests.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1