File tree 2 files changed +4
-14
lines changed
2 files changed +4
-14
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use App \Models \User ;
6
6
use Illuminate \Http \Request ;
7
+ use Illuminate \Support \Facades \Hash ;
7
8
8
9
class RegisterController extends Controller
9
10
{
@@ -29,7 +30,9 @@ public function __invoke(Request $request)
29
30
return $ this ->failure ('E-Mail already taken. ' );
30
31
}
31
32
32
- $ user = User::create ($ request ->all ());
33
+ $ user = User::create (array_merge ($ request ->all (), [
34
+ 'password ' => Hash::make ($ request ->password ),
35
+ ]));
33
36
34
37
return response ()->json ([
35
38
'success ' => true ,
Original file line number Diff line number Diff line change 7
7
use Illuminate \Database \Eloquent \Factories \HasFactory ;
8
8
use Illuminate \Foundation \Auth \User as Authenticatable ;
9
9
use Illuminate \Notifications \Notifiable ;
10
- use Illuminate \Support \Facades \Hash ;
11
10
use Tymon \JWTAuth \Contracts \JWTSubject ;
12
11
13
12
class User extends Authenticatable implements JWTSubject
@@ -46,16 +45,4 @@ class User extends Authenticatable implements JWTSubject
46
45
protected $ casts = [
47
46
'email_verified_at ' => 'datetime ' ,
48
47
];
49
-
50
- /**
51
- * Perform any actions required after the model boots.
52
- *
53
- * @return void
54
- */
55
- protected static function booted ()
56
- {
57
- static ::creating (function (User $ user ) {
58
- $ user ->fill (['password ' => Hash::make ($ user ->password )]);
59
- });
60
- }
61
48
}
You can’t perform that action at this time.
0 commit comments