Steps:
1. Create a MySQL database
2. Open the .env file and set the database connection
3. Run the following command to set project namespace
php artisan app:name todoparrot
4. Create a model named todolist using the following command
php artisan make:model Todolist
5. Open the migration folder and delete all existing file
6. Run the following command to create a migration file for todolist table
php artisan make:migration create_todolist_table
7. Open the migration file and modify up function by the following code
Schema::create('todolists', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->text('description');
$table->timestamps();
});
8. Run the following command to create the todolist table using migration file
php artisan migrate
9. Run the following command to create migration file for adding new column to todolist table
php artisan make:migration add_note_to_todolist_table --table=todolist
10. Open the migration file and modify the code
public function up()
{
Schema::table('tasks', function(Blueprint $table)
{
$table->string('note');
});
}
public function down()
{
Schema::table('tasks', function(Blueprint $table)
{
$table->dropColumn('note');
});
}
11. Run the migration command again
12. Add the following code in the up function to add new column with order.
$table->string('address', 100)->after('description');