I have this weird problem. and I want a "yes" in all clients. I am using laravel 8 in client and API using laragon, with php 8.1.7 with apache 2.4.54
namespace App\Http\Controllers\Api\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
use App\Http\Resources\UserResource;
class LoginController extends Controller
{
public function store(Request $request)
{
$request->validate([
'email' => 'required|string|email',
'password' => 'required|string',
]);
$user = User::where('email', 'xxxxxxx@gmail.com')->firstOrFail();
return response()->json(['message' => (Hash::check('asd.4567', $user->password) ? 'yes': 'no')]);
//it says yes, in thunder client, or php artisan tinker from the client page
//it says no, from client page in web
if (Hash::check($request->password, $user->password)) {
return UserResource::make($user);
} else {
return response()->json(['message' => 'These credentials do not match our records.'], 404);
}
}
}
this is using apache, when I use nginx this part works, but no other thing that I need.