I am trying to get the user which is sending the request using this code:
$user = User::where('email', $request['email'])->first();
But it returns null, even though the user is already in the database. Any ideas?
I am trying to get the user which is sending the request using this code:
$user = User::where('email', $request['email'])->first();
But it returns null, even though the user is already in the database. Any ideas?
Please try this, Just return or print or echo or anything. But, check with this below code and say what happened.
public function mailData(Request $request){
User::where('email', $request->input('email'))->first()
};
I hope this will help you..
The function should be have request and the method will POST or PUT and If you are using GET means you can get email from routes.
public function mailData($email){
User::where('email', $email)->first()
}