Using tinker:
>>> $user = User::create(['name_first' => 'test', 'name_last' => 'last', 'password' => Hash::make('password'), 'email' => 'test3@test.com']);
=> App\Models\User {#4771
name_first: "test",
name_last: "last",
password: "$2y$10$9Yjm2xf0PBWdvbw42q3i5.7xW8UoXyLtDHHFI8LTerRIV3R0efvbi",
email: "test3@test.com",
uuid: Ramsey\Uuid\Lazy\LazyUuidFromString {#4732
uuid: "0ef8dfaf-1068-4349-a4fe-5f0f23a30e58",
},
updated_at: "2022-09-12 23:17:06",
created_at: "2022-09-12 23:17:06",
id: 105,
}
This returns true as expected.
>>> Hash::check('password', $user->password);
=> true
I copy pasted this code in my FortifyServiceProvider.php: https://laravel.com/docs/9.x/fortify#customizing-user-authentication
When trying to log in with the User I created using tinker using my frontend (Vue 3 SPA with Sanctum and Fortify), I keep getting the message These credentials do not match our records.. Why is that?
By the way, for viewing purposes, I commented password from the $hidden array in User.php