diff --git a/app/Models/CompanyUser.php b/app/Models/CompanyUser.php index 26f21eccbd..302e68271d 100644 --- a/app/Models/CompanyUser.php +++ b/app/Models/CompanyUser.php @@ -47,6 +47,7 @@ class CompanyUser extends Pivot 'is_locked', 'slack_webhook_url', 'shop_restricted', + 'number_years_active', ]; protected $touches = ['user']; diff --git a/app/Transformers/CompanyUserTransformer.php b/app/Transformers/CompanyUserTransformer.php index a9a7045699..e05ed452bf 100644 --- a/app/Transformers/CompanyUserTransformer.php +++ b/app/Transformers/CompanyUserTransformer.php @@ -51,6 +51,7 @@ class CompanyUserTransformer extends EntityTransformer 'archived_at' => (int) $company_user->deleted_at, 'created_at' => (int) $company_user->created_at, 'permissions_updated_at' => (int) $company_user->permissions_updated_at, + 'number_years_active' => (int) $company_user->number_years_active, ]; } diff --git a/database/migrations/2021_04_29_085418_add_number_years_active_to_company_users_table.php b/database/migrations/2021_04_29_085418_add_number_years_active_to_company_users_table.php new file mode 100644 index 0000000000..6d5c1d7e58 --- /dev/null +++ b/database/migrations/2021_04_29_085418_add_number_years_active_to_company_users_table.php @@ -0,0 +1,37 @@ +unsignedInteger('number_years_active')->default(3); + }); + + CompanyUser::cursor()->each(function ($cu){ + $cu->number_years_active = 3; + $cu->save(); + }); + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + + } +}