AiTeky Original Interactive Learning & Practice Intermediate
PHP and Laravel: queries per page, mass assignment and jobs that run twice
Understand why a Laravel page can run hundreds of database queries without a single error, why letting a form set any field is dangerous, and why a queued job must be safe to run twice.
PHP powers a large share of the web, and Laravel is its most popular framework. It makes common work short and pleasant, and that is exactly why three problems are easy to create without noticing: too many database queries on one page, forms that can change fields they should not, and background jobs that run more than once.
This course models those ideas with small Python programs you can run in your browser. Python stands in for PHP: the code is not PHP, but the behaviour and the numbers show how the framework works. Check the Laravel documentation for exact syntax (for example with(), $fillable and ShouldBeUnique). All numbers are made up.
- Learn lessons explain one idea at a time and let you run it.
- Industry ready lessons decide and justify, and end with interview questions.
No PHP experience is assumed. Basic Python helps.
- ▶ Run code in your browser. Nothing to install
- ✓ Exercises that check themselves
- 📖 Tap a word to see what it means
Locked. Sign up free
Learn
Understand each idea with everyday examples. No coding background needed.
- 00 25 min 🔒 AiTeky Pass Start here: from request to page Follow a web request from the address a visitor types to the page that comes back, and see the three parts of a Laravel app: routes, controllers and the data behind them.
- 01 30 min Free sample 🔒 AiTeky Pass One query or one hundred Model a list page that loads related data one row at a time (the N+1 problem), count the database queries, and see how loading the related rows in one extra query keeps the count flat as the page grows.
- 02 30 min 🔒 AiTeky Pass Who may set which field Model a form that saves whatever fields the browser sends (mass assignment), see how a user can promote themselves to admin by adding one extra field, and fix it with an allow-list of fields.
Industry ready
Real problems from real jobs, and the questions interviewers ask about them.

