Laravel Security & Session
1
Which facade is commonly used to handle user authentication in Laravel?
Auth
Session
User
Gate
2
How do you check if a user is authenticated in a Blade view?
@if (Auth::check())
@if (User::logged_in())
@if (Session::check())
@if (Auth::user())
3
What is the default method used for logging in a user in Laravel?
Auth::login()
Auth::attempt()
Auth::authenticate()
Auth::signin()
4
Which method is used to log out an authenticated user?
Auth::logout()
Auth::signout()
Session::destroy()
Auth::end()
5
Which method retrieves the currently authenticated user?
Auth::user()
User::current()
Session::user()
Auth::get()
6
What is the main method for authorizing user actions in Laravel?
Gates and policies
Middleware and controllers
Sessions and cookies
Blade templates
7
Which method is used to define a gate in Laravel?
Gate::define()
Auth::authorize()
User::defineGate()
Role::gate()
8
How do you check a gate in a controller?
Gate::allows()
Auth::check()
Session::authorize()
Policy::validate()
9
What is the purpose of a policy in Laravel?
To control access to Eloquent models
To define user roles
To validate input data
To store session data
10
Which command generates a policy in Laravel?
php artisan make:policy
php artisan create:policy
php artisan make policy
php artisan create policy
11
Which Laravel helper function is used for encryption?
encrypt()
hash()
secure()
crypt()
12
What is the corresponding function for decrypting data in Laravel?
decrypt()
decode()
uncrypt()
unhash()
13
What encryption algorithm does Laravel use by default?
AES-256
SHA-256
RSA
Blowfish
14
Which facade is used for hashing passwords in Laravel?
Hash
Crypt
Auth
Password
15
Which method is used to hash a password in Laravel?
Hash::make()
Hash::create()
Hash::encrypt()
Hash::password()