How i can make voyager login using "login" field or "username" field from "users" table instead using email
Thank You
I think that is not from Voyager admin)))
See this tutorial:
http://laraveldaily.com/auth-login-with-username-instead-of-email/
Hi i know that one, but i am using voyager, and from admin/login, it use email, and how i can make it using username instead emal?
Open \vendor\tcg\voyager\src\Http\Controllers\VoyagerAuthController.php"
change postLogin method to :
public function postLogin(Request $request)
{
$this->validate($request, [
'name' => 'required', 'password' => 'required',
]);
if ($this->hasTooManyLoginAttempts($request)) {
$this->fireLockoutEvent($request);
return $this->sendLockoutResponse($request);
}
$credentials = $request->only('name', 'password');
if ($this->guard()->attempt($credentials, $request->has('remember'))) {
return $this->sendLoginResponse($request);
}
$this->incrementLoginAttempts($request);
return $this->sendFailedLoginResponse($request);
}
Open \vendor\tcg\voyager\resources\views\login.blade.php
change input type from email to name
Example must be
<input type="text" name="name" value="{{ old('name') }}" required>
Try this solution!
hi, thank you.
i give a try
super!!!!!
Guys, changing core code is a bad idea. When you'll update voyager those changes will be replaced with newer version of voyager.
@sikhub you are right that is a bad idea, but hrace009 question need answer)))))
Better publish controller and override the code, don't hack the core.
Labels: question, feature
@uchsarath how can one accomplish this, thanks for any pointers
This is a really old issue... The solution is a Laravel/PHP one, not specific to Voyager. You should be able to extend the controller with your own, overriding only the methods you need to change, then change the routes to use your new controller instead of Voyager's. This is definitely an advanced-level change.
I'm going to close this as it's answered and for a much older version of Voyager.
thanks !
Hey If I want replace VoyagerAuthController where I can place it on App?
This has been closed for ~2 years. Please don't revive old closed issues
Most helpful comment
Better publish controller and override the code, don't hack the core.