How to Write if() function like if $request data match with $user->id?
I will write like this, but not working:
if ($user->id == $request->userid){
}
else {
return back()->with('alert', 'Referral Info Invalid.');
}
How to Write if() function like if $request data match with $user->id?
I will write like this, but not working:
if ($user->id == $request->userid){
}
else {
return back()->with('alert', 'Referral Info Invalid.');
}
if you route has a middle ware ('auth') it should has a user() function to get the current user:
if ($user->id == $request->user()->id){
}
but if the userId is not belongs to current user and you want it as a request parameter you could use:
if ($user->id == $request->input('userId')){
}