How can i check phone number exist or not from user & payments tables

Posted 4 months ago by raviawasti

How can i check phone number which exist or not in user & payment table.

I have user table which has id, name, phone, email etc & payments table which has id, phone, status

I am able to search phone number from Payments table like this:-

public function search(Request $request) {

if (Payments::where('phone', '=', $request->phone)->exists()) {

               return Redirect()->back()->withInput()->with('error', 'This Number exist !');

} else{ return Redirect()->back()->withInput()->with('success', 'This Number not exist!'); }

}

But i want to search from both table users & payments table in laravel

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.