diff --git a/app/Customer.php b/app/Customer.php index 2505b4a5..394be6b4 100644 --- a/app/Customer.php +++ b/app/Customer.php @@ -446,7 +446,7 @@ class Customer extends Model * * @var [type] */ - protected $fillable = ['first_name', 'last_name', 'company', 'job_title', 'address', 'city', 'state', 'zip', 'country', 'photo_url', 'age', 'gender', 'background']; + protected $fillable = ['first_name', 'last_name', 'company', 'job_title', 'address', 'city', 'state', 'zip', 'country', 'photo_url', 'age', 'gender', 'notes']; /** * Fields stored as JSON. @@ -920,8 +920,8 @@ class Customer extends Model unset($data['photo_url']); } - if (!empty($data['notes']) && empty($data['background'])) { - $data['background'] = $data['notes']; + if (!empty($data['background']) && empty($data['notes'])) { + $data['notes'] = $data['background']; } if ($replace_data) { diff --git a/database/migrations/2020_11_19_070000_update_customers_table.php b/database/migrations/2020_11_19_070000_update_customers_table.php new file mode 100644 index 00000000..516b01a6 --- /dev/null +++ b/database/migrations/2020_11_19_070000_update_customers_table.php @@ -0,0 +1,36 @@ +dropColumn('age'); + $table->dropColumn('gender'); + $table->renameColumn('background', 'notes'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('customers', function (Blueprint $table) { + $table->string('age', 7)->nullable(); + $table->unsignedTinyInteger('gender')->nullable(); + $table->renameColumn('notes', 'background'); + }); + } +} diff --git a/resources/views/customers/partials/edit_form.blade.php b/resources/views/customers/partials/edit_form.blade.php index 7ce9b732..ee2d3a39 100644 --- a/resources/views/customers/partials/edit_form.blade.php +++ b/resources/views/customers/partials/edit_form.blade.php @@ -241,13 +241,13 @@ -