Recall & Review
beginner
What is a Model in Laravel?
A Model in Laravel represents a table in the database. It helps you interact with that table, like adding, updating, or retrieving data.
Click to reveal answer
beginner
How do you create a new Model using Artisan CLI?
You run the command
php artisan make:model ModelName. This creates a new Model file in the app/Models folder.Click to reveal answer
beginner
What folder does Laravel put new Models in by default?
Laravel puts new Models inside the
app/Models folder by default.Click to reveal answer
beginner
How does a Model know which database table to use?
By default, Laravel uses the plural form of the Model name as the table name. For example, a Model named
Post uses the posts table.Click to reveal answer
intermediate
How can you specify a custom table name in a Laravel Model?
Inside the Model class, set the protected property
$table to your custom table name, like protected $table = 'my_table';.Click to reveal answer
Which command creates a new Model in Laravel?
✗ Incorrect
The correct command to create a new Model is
php artisan make:model ModelName.Where are Laravel Models stored by default?
✗ Incorrect
Laravel stores Models by default in the
app/Models directory.If your Model is named
Product, what table does Laravel expect by default?✗ Incorrect
Laravel uses the plural lowercase form
products as the default table name.How do you tell a Model to use a different table name?
✗ Incorrect
You set
protected $table = 'custom_table'; inside the Model class.What does a Laravel Model represent?
✗ Incorrect
A Model represents a database table and helps interact with its data.
Explain how to create a new Model in Laravel and where it is stored.
Think about the Artisan command and default folder.
You got /3 concepts.
Describe how Laravel decides which database table a Model uses and how to change it.
Consider default naming and customization.
You got /3 concepts.