I am trying to make a user profile with laravel! I can set the session I can see the data into the controller but now I want to compact the data for the profile blade.
public function profile(Request $request)
{
$validatedData = $request->validate([
'email' => 'required|email',
'password' => 'required',
]);
$user = DB::table('user_registers')
->where('email',$request->input('email'))
->first();
if (!empty($user->email)) {
if(Hash::check($request->password, $user->password))
{
$request->session()->put('data',$request->input('email'));
if ($request->session()->has('data')) {
return view('fontend.index')->with('data', $request->input('email'));
}
}else{
return back()->with('password','Incorrect Password!');
}
}else {
return back() ->with('email','Please Insert a valid email');
}
}
session('data')
in your view. – Don't Panic