โ† All LARAVEL Flashcard Decks

Ultimate Laravel Flashcards

7 cards from real LARAVEL practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Ultimate Laravel flashcards as text
  1. Which Artisan command creates a new middleware class in Laravel?

    Answer: php artisan make:middleware MyMiddleware

    The `php artisan make:middleware` command scaffolds a new middleware class in the `app/Http/Middleware` directory.

  2. In Laravel, what does the `withTrashed()` scope do when querying an Eloquent model?

    Answer: Includes soft-deleted records in query results

    `withTrashed()` extends a query to include rows where `deleted_at` is not null, used with soft-deleting models.

  3. Which Laravel facade is used to dispatch a queued job?

    Answer: Bus::dispatch()

    The `Bus` facade (or the `dispatch()` helper) dispatches jobs; `Bus::dispatch(new MyJob())` queues or executes the job.

  4. What is the purpose of Laravel's `config/cache.php` `prefix` option?

    Answer: Prepends a string to all cache keys to avoid collisions across applications

    The `prefix` option is prepended to every cache key, preventing collisions when multiple apps share the same cache store.

  5. Which method on a Laravel Collection lazily evaluates a chain of operations without loading all items into memory at once?

    Answer: lazy()

    `LazyCollection::lazy()` or using `LazyCollection::make()` evaluates items one at a time using PHP generators, minimizing memory usage.

  6. In Laravel's service container, what is 'contextual binding' used for?

    Answer: Injecting different implementations of an interface depending on which class requests it

    Contextual binding lets you specify that when class A needs an interface, it gets implementation X, while class B gets implementation Y.

  7. What does the `@stack` Blade directive do?

    Answer: Renders content that was pushed onto a named stack from child views

    `@stack('name')` outputs everything pushed to that named stack via `@push` directives in child or included views.

How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy