Bird
0
0

Given this route group code, what URL will respond to the Route::get('profile', ...) route?

medium📝 component behavior Q4 of 15
Laravel - Routing
Given this route group code, what URL will respond to the Route::get('profile', ...) route?
Route::group(['prefix' => 'user'], function () {
    Route::get('profile', function () {
        return 'User Profile';
    });
});
A/profile/user
B/user/profile
C/user
D/profile
Step-by-Step Solution
Solution:
  1. Step 1: Understand prefix effect on route URIs

    The prefix 'user' adds '/user' before all routes inside the group.
  2. Step 2: Combine prefix with route URI

    The route URI is 'profile', so full URL path is '/user/profile'.
  3. Final Answer:

    /user/profile -> Option B
  4. Quick Check:

    Prefix + route URI = full URL path [OK]
Quick Trick: Prefix + route URI = full URL path [OK]
Common Mistakes:
  • Ignoring prefix and using only route URI
  • Reversing prefix and URI order
  • Assuming prefix replaces route URI

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes