Skip to content

Commit

Permalink
Update UserController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
imtyaz-17 authored Jul 4, 2024
1 parent 6000054 commit 27f4adc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ public function check_create($name, $email)
// if not found, create a user with $name, $email and random password
$user = User::where('name', $name)->where('email', $email)->first();
if (!$user) {
$password = Str::random(8);
$user = User::create([
'name' => $name,
'email' => $email,
'password' => bcrypt(str_random(8))
'password' => bcrypt($password)
]);
}
return view('users.show', compact('user'));
Expand All @@ -56,10 +57,11 @@ public function check_update($name, $email)
$user->save();
}
else {
$password = Str::random(8);
$user = User::create([
'name' => $name,
'email' => $email,
'password' => bcrypt(str_random(8))
'password' => bcrypt($password)
]);
}
return view('users.show', compact('user'));
Expand Down

0 comments on commit 27f4adc

Please sign in to comment.