diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 1cbc83de..169e89c2 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -25,8 +25,19 @@ class AuthController extends Controller 'online' => 'integer', 'register_agree' => 'required|integer', 'email' => 'required|string|unique:users,email', - 'password' => 'required|string|confirmed' + 'password' => 'required|string|confirmed', + 'front_img_path' => 'required|mimes:jpg,png,jpeg|max:5048', + 'back_img_path' => 'required|mimes:jpg,png,jpeg|max:5048' + ]); + + $newFrontImageName = time() . '-' . $request->name . '.' . $request->front_img_path->extension(); + + $newBackImageName = time() . '-' . $request->username . '.' . $request->back_img_path->extension(); + + $request->front_img_path->move(public_path('ic'), $newFrontImageName); + + $request->back_img_path->move(public_path('ic'), $newBackImageName); $user = User::create([ 'name' => $fields['name'], @@ -43,7 +54,10 @@ class AuthController extends Controller 'register_agree' => $fields['register_agree'], 'email' => $fields['email'], 'email' => $fields['email'], - 'password' => bcrypt($fields['password']) + 'password' => bcrypt($fields['password']), + 'front_img_path' => $newFrontImageName, + 'back_img_path' => $newBackImageName + ]); $token = $user->createToken('myapptoken')->plainTextToken; @@ -61,7 +75,7 @@ class AuthController extends Controller 'password' => 'required|string' ]); - //Check Email + //Check username $user = User::where('username', $fields['username'])->first(); //Check Password diff --git a/app/Models/User.php b/app/Models/User.php index 2e6b3054..43d162fd 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -35,6 +35,9 @@ class User extends Authenticatable 't_daftar', 'online', 'register_agree', + 'front_img_path', + 'back_img_path', + ]; /** diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 884955f8..2e13be3a 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -32,6 +32,8 @@ class CreateUsersTable extends Migration $table->string('email')->nullable(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); + $table->string('front_img_path'); + $table->string('back_img_path'); $table->rememberToken(); $table->timestamps(); }); diff --git a/public/ic/1641952392-Aliaa.jpg b/public/ic/1641952392-Aliaa.jpg new file mode 100644 index 00000000..c1b4c3c3 Binary files /dev/null and b/public/ic/1641952392-Aliaa.jpg differ diff --git a/public/ic/1641952392-Aliaa11.jpg b/public/ic/1641952392-Aliaa11.jpg new file mode 100644 index 00000000..70ceed66 Binary files /dev/null and b/public/ic/1641952392-Aliaa11.jpg differ