Do the following:
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('tasks', function (Blueprint $table) {
$table->string('title')->after('your-column-name');
});
}
Replace 'your-column-name' with your existing column name.
Save the file. From terminal, execute:
php artisan migrate
The above command will add the column to your table.
You are getting that error because you are not running the migrate
command.
Whenever you create a migration file, you must execute the above command in order to see the changes in your database table.
Also, if the new column does not exist in the models $fillable
property, you will have to add it there as well..
/**
* The attributes that are mass assignable.
*
* @return array
*/
protected $fillable = [
'title', // <-- new column name
// .. other column names
];
Failing to do update the $fillable
property will result in MassAssignmentExecption
Hope this helps you out. Happy Coding. Cheers.