Skip to main content
InterviewHubPRO
Section Overview
Q12

Question 12 of 50

Part 2: Eloquent ORM, Security & Queue Ecosystem (11 - 24)

24%
Laravel & Ecosystem (50 Qs)•Part 2: Eloquent ORM, Security & Queue Ecosystem (11 - 24)

How does Laravel handle Authentication and Authorization (Gates vs Policies)?

mid LevelSecurity & AuthData Structures

In Simple Words:

  • Authentication: Verifies who the user is (handled via Laravel Breeze, Jetstream, or Fortify).
  • Authorization: Verifies what the user is allowed to do:
    • Gates: Closure-based authorization for simple, ad-hoc actions: Gate::define('edit-settings', fn(User $user) => $user->isAdmin);
    • Policies: Dedicated classes organized around specific Eloquent models: $this->authorize('update', $post); calls PostPolicy::update(User $user, Post $post).