What is multi-authentication in Laravel?
Why Interviewers Ask This
Advanced questions like this reveal whether a candidate has internalized Laravel deeply enough to make architectural decisions. Strong answers demonstrate both breadth and depth of experience.
Answer
Multi-authentication allows different types of users (e.g., admins and regular users) to authenticate separately with their own guards and models. Configure in config/auth.php: add a new guard ("admin" => ["driver" => "session", "provider" => "admins"]) and a provider ("admins" => ["driver" => "eloquent", "model" => Admin::class]). Authenticate via specific guard: Auth::guard("admin")->attempt($credentials). Check authentication: Auth::guard("admin")->check(). Get current admin: Auth::guard("admin")->user(). Protect admin routes with the guard middleware: Route::middleware("auth:admin")->group(...). Each guard has separate session keys, so logging in as admin does not affect the user session and vice versa. Sanctum supports multiple guards as well for API token-based multi-auth.
Common Mistake
Many candidates answer correctly but can't explain the 'why'. Always be prepared to justify your answer with a concrete example or use case from your Laravel experience.
Previous
What is the HasUuids trait in Laravel?
Next
What is the when() method in Laravel Query Builder?