Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add field address #1030

Merged
merged 7 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Controllers/BadasoAuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ public function register(Request $request)
'phone' => 'required|numeric|min:6',
'email' => 'required|string|email|max:255|unique:Uasoft\Badaso\Models\User',
'password' => 'required|string|min:6|confirmed',
'address' => 'required|string|max:255',
'gender' => 'required|string',
]);

$user = User::create([
Expand All @@ -183,6 +185,8 @@ public function register(Request $request)
'phone' => $request->get('phone'),
'email' => $request->get('email'),
'password' => Hash::make($request->get('password')),
'address' => $request->get('address'),
'gender' => $request->get('gender'),
]);

$role = $this->getCustomerRole();
Expand Down Expand Up @@ -540,14 +544,20 @@ public function updateProfile(Request $request)
'name' => 'required|string|max:255',
'username' => "required|string|max:255|alpha_num|unique:Uasoft\Badaso\Models\User,username,{$user_id}",
'avatar' => 'nullable',
'phone' => 'nullable',
'address' => 'nullable',
'gender' => 'nullable',
]);

$user = User::find($user->id);

$user->name = $request->name;
$user->username = $request->username;
$user->phone = $request->phone;
$user->address = $request->address;
$user->avatar = $request->avatar;
$user->additional_info = $request->additional_info;
$user->gender = $request->gender;
$user->save();

DB::commit();
Expand Down
12 changes: 12 additions & 0 deletions src/Controllers/BadasoUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,20 @@ public function edit(Request $request)
'username' => "required|string|max:255|alpha_num|unique:Uasoft\Badaso\Models\User,username,{$request->id}",
'name' => 'required',
'avatar' => 'nullable',
'phone' => 'nullable',
'address' => 'nullable',
'gender' => 'nullable',
]);

$user = User::find($request->id);
$old_user = $user->toArray();

$user->name = $request->name;
$user->email = $request->email;
$user->phone = $request->phone;
$user->address = $request->address;
$user->avatar = $request->avatar;
$user->gender = $request->gender;
$user->additional_info = $request->additional_info;
if ($request->password && $request->password != '') {
$user->password = Hash::make($request->password);
Expand Down Expand Up @@ -104,14 +110,20 @@ public function add(Request $request)
'name' => 'required|string|max:255',
'username' => 'required|string|max:255|alpha_num|unique:Uasoft\Badaso\Models\User,username',
'avatar' => 'nullable',
'phone' => 'required|numeric|min:6',
'address' => 'nullable',
'gender' => 'required|string',
]);

$user = new User();
$user->name = $request->name;
$user->username = $request->username;
$user->phone = $request->phone;
$user->address = $request->address;
$user->email = $request->email;
$user->avatar = $request->avatar;
$user->additional_info = $request->additional_info;
$user->gender = $request->gender;
$user->password = Hash::make($request->password);
if ($request->email_verified) {
$user->email_verified_at = date('Y-m-d H:i:s');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddAddressToBadasoUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table(config('badaso.database.prefix').'users', function (Blueprint $table) {
$table->text('address')->nullable()->after('phone');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table(config('badaso.database.prefix').'users', function (Blueprint $table) {
$table->dropColumn('address');
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddGenderToBadasoUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table(config('badaso.database.prefix').'users', function (Blueprint $table) {
$table->enum('gender', ['man', 'woman'])->nullable()->after('additional_info');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table(config('badaso.database.prefix').'users', function (Blueprint $table) {
$table->dropColumn('gender');
});
}
}
2 changes: 2 additions & 0 deletions src/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public function __construct(array $attributes = [])
'email',
'password',
'avatar',
'address',
'gender',
'additional_info',
'last_sent_token_at',
];
Expand Down
50 changes: 45 additions & 5 deletions src/resources/js/lang/modules/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,22 @@ export default {
field: {
name: "Name",
username: "Username",
phone:"Phone",
phone: "Phone",
address: "Address",
email: "Email",
password: "Password",
passwordConfirmation: "Password Confirmation",
gender: "Gender",
},
button: "Register",
existingAccount: {
text: "Do you have an account?",
link: "Login",
},
gender: {
man: "Man",
woman: "Woman",
},
},

forgotPassword: {
Expand Down Expand Up @@ -125,6 +131,9 @@ export default {
newPasswordConfirmation: "New Password Confirmation",
name: "Name",
avatar: "Avatar",
phone: "Phone Number",
address: "Address",
gender: "Gender",
additionalInfo: "Additional info(optional)",
token: "Verification Code",
buttons: {
Expand Down Expand Up @@ -251,7 +260,7 @@ export default {
edit: {
multiple: "Update Configurations",
},
maintenanceMode: "Maintenance setting is readonly."
maintenanceMode: "Maintenance setting is readonly.",
},

crud: {
Expand Down Expand Up @@ -666,6 +675,14 @@ export default {
title: "Username",
placeholder: "Username",
},
phone: {
title: "Phone Number",
placeholder: "Phone Number",
},
address: {
title: "Address",
placeholder: "Address",
},
email: {
title: "Email",
placeholder: "Email",
Expand All @@ -682,6 +699,10 @@ export default {
title: "Avatar",
placeholder: "Avatar",
},
gender: {
title: "Gender",
placeholder: "Gender",
},
additionalInfo: {
title: "Additional Info (JSON)",
placeholder: "Additional Info (JSON)",
Expand All @@ -701,6 +722,14 @@ export default {
title: "Username",
placeholder: "Username",
},
phone: {
title: "Phone Number",
placeholder: "Phone Number",
},
address: {
title: "Address",
placeholder: "Address",
},
email: {
title: "Email",
placeholder: "Email",
Expand All @@ -717,6 +746,10 @@ export default {
title: "Avatar",
placeholder: "New Avatar",
},
gender: {
title: "Gender",
placeholder: "Gender",
},
additionalInfo: {
title: "Additional Info (JSON)",
placeholder: "Additional Info (JSON)",
Expand All @@ -730,7 +763,10 @@ export default {
avatar: "Avatar",
name: "Name",
username: "Username",
phone: "Phone Number",
address: "Address",
email: "Email",
gender: "Gender",
additionalInfo: "Additional Info",
emailVerified: "Is Email Verified",
},
Expand All @@ -747,6 +783,10 @@ export default {
text: "Roles has been set",
},
},
gender: {
man: "Man",
woman: "Woman",
},
},

role: {
Expand Down Expand Up @@ -850,7 +890,7 @@ export default {
isPublic: "Is Public",
action: "Action",
rolesCanSeeAllData: "Roles Can See All Data",
fieldIdentifyRelatedUser: "Field Identify Related User"
fieldIdentifyRelatedUser: "Field Identify Related User",
},
footer: {
descriptionTitle: "Registries",
Expand Down Expand Up @@ -901,7 +941,7 @@ export default {
fieldIdentifyRelatedUser: {
title: "Column for identify user related data",
placeholder: "Column for identify user related data",
}
},
},
button: "Save",
},
Expand All @@ -922,7 +962,7 @@ export default {
},
button: "Edit",
rolesCanSeeAllData: "Roles Can See All Data",
fieldIdentifyRelatedUser: "Field Identify Related User"
fieldIdentifyRelatedUser: "Field Identify Related User",
},
},

Expand Down
Loading
Loading