bipin
301
4
Laravel

override auth function to create login form in which user can login with email id or phone number

Posted 2 years ago by bipin

hello guys i m try to override auth function to create login form in which user can login with email id or phone number so i m try to override inbuilt auth here is location vendor\laravel\framework\src\foundation\auth\authenticatesuser.php

here is code i want to override $username i want to pass two variable in $username like 'phone' and 'email' using "or" condition how i can achieve this

public function loginUsername() { return property_exists( $this,'username') ? $username : 'phone';

  }

is this a best way to edit ? or any other way in which i can achieve all functionality provide by auth in laravel 5.2

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