Skip to content
This repository was archived by the owner on Feb 18, 2023. It is now read-only.

Commit baff5e1

Browse files
committed
mutate the password on the model.
1 parent 3c673af commit baff5e1

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

app/Entities/User.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,15 @@ class User extends Authenticatable
3737
protected $hidden = [
3838
'password', 'remember_token',
3939
];
40+
41+
/**
42+
* Set the user's password
43+
*
44+
* @param string $value
45+
* @return void
46+
*/
47+
public function setPasswordAttribute($value)
48+
{
49+
$this->attributes['password'] = bcrypt($value);
50+
}
4051
}

app/Services/Installation/InstallAppHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function createAdminUser(array $attributes = [])
114114
$this->adminUser = User::create([
115115
'name' => $attributes['name'],
116116
'email' => $attributes['email'],
117-
'password' => bcrypt($attributes['password'])
117+
'password' => $attributes['password']
118118
]);
119119
return $this;
120120
}

database/factories/ModelFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'name' => $faker->name,
2020
'uuid' => $faker->uuid,
2121
'email' => $faker->unique()->safeEmail,
22-
'password' => $password ?: $password = bcrypt('secret'),
22+
'password' => $password ?: $password = 'secret',
2323
'remember_token' => str_random(10),
2424
];
2525
});

0 commit comments

Comments
 (0)