I'm traing to check a password validation without do login in a Laravel 10 project, but the function 'check' returns false, moreover, I can do login with the same password. I Don't know why return false.
Thanks.
public function recharge_by_client(Request $request){ $telf = $request->telf; $password = $request->password; $credit = $request->credit; try { $client = Client::where('telf', $telf)->first(); //if verification data is false, returning 0. if ($client && Hash::check($password, $client->password)) { \Log::info('Entramos a update'); HomeHelper::recharge_money($client->id, $credit); }else{ \Log::info('NO entramos a update'); return ['credit_updated' => 0]; } } catch (\Exception $e) { \Log::info($e->getMessage()); //A exception has ocurre, returning 0. return ['credit_updated' => 0]; } //Returning current credit. return ['credit_updated' => Client::find($client->id)->credit]; }