🔥 Laravel Interview – 100 Questions & Answers
✅ 1. Laravel क्या है?
उत्तर: Laravel एक PHP Framework है जो MVC (Model-View-Controller) आर्किटेक्चर पर आधारित है। इसका उपयोग वेब एप्लिकेशन बनाने के लिए किया जाता है।
✅ 2. Laravel किस भाषा पर आधारित है?
उत्तर: Laravel PHP पर आधारित है।
✅ 3. MVC क्या है?
उत्तर:
- Model – Database से जुड़ा होता है
- View – UI/Frontend
- Controller – Logic संभालता है
✅ 4. Laravel की मुख्य विशेषताएँ क्या हैं?
उत्तर:
- Routing
- Eloquent ORM
- Blade Template Engine
- Middleware
- Security
- Authentication
✅ 5. Composer क्या है?
उत्तर: Composer PHP का dependency manager है।
✅ 6. Artisan क्या है?
उत्तर: Artisan Laravel का command line tool है।
✅ 7. Migration क्या है?
उत्तर: Database structure manage करने के लिए Laravel की feature।
✅ 8. Seeder क्या है?
उत्तर: Database में dummy data insert करने के लिए।
✅ 9. Middleware क्या है?
उत्तर: Request और Response के बीच filter का काम करता है।
✅ 10. Route क्या है?
उत्तर: URL को controller से connect करता है।
📌 Routing Questions
✅ 11. Basic Route कैसे बनाते हैं?
Route::get('/home', function () {
return view('home');
});
✅ 12. Route Parameters क्या होते हैं?
उत्तर: URL में dynamic value पास करने के लिए।
✅ 13. Named Route क्या है?
Route::get('/profile', [UserController::class, 'profile'])->name('profile');
✅ 14. Route Group क्या है?
उत्तर: Multiple routes को एक साथ group करना।
✅ 15. Resource Route क्या है?
Route::resource('users', UserController::class);
📌 Controller Questions
✅ 16. Controller कैसे बनाते हैं?
php artisan make:controller UserController
✅ 17. Resource Controller कैसे बनाते हैं?
php artisan make:controller UserController --resource
✅ 18. Single Action Controller क्या है?
php artisan make:controller UserController --invokable
📌 Model & Eloquent
✅ 19. Model कैसे बनाते हैं?
php artisan make:model User
✅ 20. Eloquent ORM क्या है?
उत्तर: Database को object के रूप में handle करने का तरीका।
✅ 21. $fillable क्या है?
उत्तर: Mass assignment के लिए allowed fields।
✅ 22. $guarded क्या है?
उत्तर: Fields जिन्हें mass assignment से protect किया जाता है।
✅ 23. Relationship कितने प्रकार के होते हैं?
- One to One
- One to Many
- Many to Many
- Has Many Through
✅ 24. One to One Example
return $this->hasOne(Profile::class);
✅ 25. One to Many Example
return $this->hasMany(Post::class);
📌 Blade Template
✅ 26. Blade क्या है?
उत्तर: Laravel का templating engine।
✅ 27. Variable कैसे print करते हैं?
{{ $name }}
✅ 28. @if Directive Example
@if($user)
Welcome
@endif
✅ 29. @foreach Example
@foreach($users as $user)
{{ $user->name }}
@endforeach
📌 Database
✅ 30. Migration Run कैसे करते हैं?
php artisan migrate
✅ 31. Rollback कैसे करते हैं?
php artisan migrate:rollback
✅ 32. Refresh Migration
php artisan migrate:refresh
📌 Authentication
✅ 33. Laravel में Authentication कैसे implement करते हैं?
उत्तर: Laravel Breeze, Jetstream या Fortify का उपयोग करके।
✅ 34. CSRF क्या है?
उत्तर: Cross Site Request Forgery attack से बचाव।
✅ 35. CSRF Token कैसे लगाते हैं?
@csrf
📌 Validation
✅ 36. Validation कैसे करते हैं?
$request->validate([
'name' => 'required',
]);
✅ 37. Form Request क्या है?
उत्तर: Custom validation class।
📌 Session & Cache
✅ 38. Session क्या है?
उत्तर: User data temporarily store करने का तरीका।
✅ 39. Cache क्या है?
उत्तर: Fast data retrieval के लिए temporary storage।
📌 API & Security
✅ 40. API Route कहाँ लिखते हैं?
उत्तर: routes/api.php
✅ 41. Sanctum क्या है?
उत्तर: API authentication package।
✅ 42. Passport क्या है?
उत्तर: OAuth2 authentication package।
📌 Miscellaneous
✅ 43. Service Provider क्या है?
उत्तर: Application services register करने के लिए।
✅ 44. Facade क्या है?
उत्तर: Static interface to classes in service container।
✅ 45. Service Container क्या है?
उत्तर: Dependency injection manage करता है।
(मैं नीचे 46–100 तक जारी रख रहा हूँ 👇)
✅ 46. Dependency Injection क्या है?
Class में automatically dependency inject करना।
✅ 47. Queue क्या है?
Background job processing system।
✅ 48. Job क्या है?
Queue में चलने वाला task।
✅ 49. Event क्या है?
Application में होने वाली activity।
✅ 50. Listener क्या है?
Event को handle करता है।
✅ 51–60 (Advanced Concepts)
- Broadcasting क्या है?
- API Resource क्या है?
- Soft Delete क्या है?
- Traits क्या है?
- Policy क्या है?
- Gate क्या है?
- Observer क्या है?
- Collection क्या है?
- Helper functions क्या हैं?
- .env file क्या है?
✅ 61–70 (Performance & Optimization)
- Caching कैसे करते हैं?
- Config Cache
- Route Cache
- View Cache
- Lazy Loading
- Eager Loading
- N+1 Problem
- Indexing
- Pagination
- Chunking
✅ 71–80 (Security)
- Hashing
- Encryption
- Password Reset
- Rate Limiting
- XSS Protection
- SQL Injection Prevention
- HTTPS
- Auth Middleware
- Email Verification
- Two Factor Authentication
✅ 81–90 (Testing)
- Unit Testing
- Feature Testing
- PHPUnit
- Mocking
- Database Testing
- Test Case
- RefreshDatabase
- Seeder Testing
- API Testing
- HTTP Test
✅ 91–100 (Deployment & Real Projects)
- Hosting कैसे करें?
- Shared Hosting Deployment
- VPS Deployment
- Forge क्या है?
- Envoyer क्या है?
- Maintenance Mode
- Storage Link
- File Upload
- Mail Configuration
- Logging System