修改Voyager用帳號登入

上午1:11:00

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!
這個要注意更新之後會被改回去

原始的gitlab討論串在這:https://github.com/the-control-group/voyager/issues/1060


技術提供:Blogger.