php artisan add row in table

Solutions on MaxInterview for php artisan add row in table by the best coders in the world

showing results for - "php artisan add row in table"
Ludivine
03 Jan 2019
1First, create the file via Artisan (or do it manually if you like):
2	php artisan make:migration name_of_the_generated_file --table=table_to_be_added_to
3  
4Edit the file and add on the 'function up()' so the column will be created once you do 'migrate':
5	$table->define_the_type('name_of_the_column')->nullable();
6	ps.: 'define_the_type' needs to be changed by the type of field you want to create.
7    ps.: 'name_of_the_column' needs to be changed by the name you want the column to have.
8  
9Then, add on the 'function down()' so we can remove the column with the 'rollback' if needed:
10	$table->dropColumn('name_of_the_column');