diff --git a/app/Http/Controllers/Auth/ProfileController.php b/app/Http/Controllers/Auth/ProfileController.php index 9f8f633..8483296 100644 --- a/app/Http/Controllers/Auth/ProfileController.php +++ b/app/Http/Controllers/Auth/ProfileController.php @@ -43,6 +43,7 @@ public function update(Request $request) 'name' => 'required|max:60', 'email' => 'required|max:255|unique:users,email,'.auth()->id(), 'account_start_date' => 'nullable|date', + 'currency_code' => 'required|string|max:3', ]); auth()->user()->update($userData); diff --git a/app/User.php b/app/User.php index 4073025..b2777cf 100644 --- a/app/User.php +++ b/app/User.php @@ -16,7 +16,7 @@ class User extends Authenticatable * @var array */ protected $fillable = [ - 'name', 'email', 'password', 'api_token', 'account_start_date', + 'name', 'email', 'password', 'api_token', 'account_start_date', 'currency_code', ]; /** diff --git a/database/migrations/2021_05_07_055937_add_currency_code_on_users_table.php b/database/migrations/2021_05_07_055937_add_currency_code_on_users_table.php new file mode 100644 index 0000000..2bd4693 --- /dev/null +++ b/database/migrations/2021_05_07_055937_add_currency_code_on_users_table.php @@ -0,0 +1,32 @@ +string('currency_code', 3)->default('IDR')->after('account_start_date'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn(['currency_code']); + }); + } +} diff --git a/resources/lang/en/user.php b/resources/lang/en/user.php index eedca4d..360d040 100644 --- a/resources/lang/en/user.php +++ b/resources/lang/en/user.php @@ -32,6 +32,7 @@ 'is_active' => 'User Status', 'registered_at' => 'Registered at', 'account_start_date' => 'Account Start Date', + 'currency_code' => 'Currency Code', // Relations 'groups' => 'Member List', diff --git a/resources/lang/id/user.php b/resources/lang/id/user.php index 3e44ded..1e30c49 100644 --- a/resources/lang/id/user.php +++ b/resources/lang/id/user.php @@ -32,6 +32,7 @@ 'is_active' => 'Status User', 'registered_at' => 'Terdaftar sejak', 'account_start_date' => 'Akun Mulai Digunakan', + 'currency_code' => 'Kode Mata Uang', // Relations 'groups' => 'List Member', diff --git a/resources/views/auth/profile/edit.blade.php b/resources/views/auth/profile/edit.blade.php index a34e31a..3b27d75 100644 --- a/resources/views/auth/profile/edit.blade.php +++ b/resources/views/auth/profile/edit.blade.php @@ -12,6 +12,7 @@ {!! FormField::text('name', ['required' => true, 'label' => __('user.name')]) !!} {!! FormField::email('email', ['required' => true, 'label' => __('user.email')]) !!} {!! FormField::text('account_start_date', ['label' => __('user.account_start_date')]) !!} + {!! FormField::text('currency_code', ['label' => __('user.currency_code')]) !!}