Unit6 - Subjective Questions

INT221 • Practice Questions with Detailed Answers

1

Define Database Migrations in Laravel. How do the up and down methods function within a migration file?

2

Explain the concept of Eloquent ORM. How does it map models to database tables?

3

Differentiate between Query Builder and Eloquent ORM with respect to performance and syntax.

4

Describe the process of Seeding in Laravel. How can Model Factories be utilized within seeders?

5

Write a PHP script to perform CRUD operations (Create, Read, Update, Delete) using Laravel's Query Builder.

6

Explain Mass Assignment in Eloquent ORM. What is the role of the guarded properties?

7

How can Laravel be configured to use MongoDB? What are the key differences when interacting with MongoDB compared to a SQL database in Laravel?

8

Discuss the implementation of REST APIs in Laravel. How do API Resources assist in transforming data?

9

Explain the concept of Soft Deletes in Eloquent ORM. How do you implement and retrieve soft deleted models?

10

What are Accessor and Mutator methods in Eloquent models? Provide examples.

11

Describe how to create a One-to-Many relationship using Eloquent ORM. Give an example of a Post and Comment scenario.

12

How do you modify an existing database table using Migrations? Explain with an example of adding a new column.

13

Explain the significance of HTTP Status Codes when implementing REST APIs in Laravel.

14

Write the Laravel artisan command to create a Model, Migration, Factory, and Controller simultaneously. Explain the flags used.

15

How does Laravel handle database configuration for different environments (Local vs Production)?

16

Explain how to perform a Join operation using Laravel's Query Builder.

17

What are API Routes in Laravel? How do they differ from Web Routes?

18

Define Database Seeding and write the procedure to run a specific seeder class.

19

Illustrate Aggregates in Query Builder with examples (count, max, min, avg, sum).

20

Discuss the Active Record Pattern and how Eloquent ORM implements it.