Edit file AuthenticatesAndRegistersUsers.php yang ada di folder vendor/laravel/framework/src/Illuminate/Foundation/Auth/

	public function postLogin(Request $request)
	{
		$this->validate($request, [
			'email' => 'required|email', 'password' => 'required',
		]);
 
		$credentials = $request->only('email', 'password');
 
		if ($this->auth->attempt($credentials, $request->has('remember')))
		{
			return redirect()->intended($this->redirectPath());
		}
 
		return redirect($this->loginPath())
					->withInput($request->only('email', 'remember'))
					->withErrors([
						'email' => $this->getFailedLoginMessage(),
					]);
	}

menjadi

public function postLogin(Request $request)
{
	$this->validate($request, [
		'username' => 'required', 'password' => 'required',
	]);
 
	$credentials = $request->only('username', 'password');
 
	if ($this->auth->attempt($credentials, $request->has('remember')))
	{
		return redirect()->intended($this->redirectPath());
	}
 
	return redirect($this->loginPath())
				->withInput($request->only('username', 'remember'))
				->withErrors([
					'username' => $this->getFailedLoginMessage(),
				]);
}

sekarang buka file template login.blade.php (resources/views/auth)

<div class="form-group">
	<label class="col-md-4 control-label">E-Mail Address</label>
	<div class="col-md-6">
		<input type="email" class="form-control" name="email" value="{{ old('email') }}">
	</div>
</div>

menjadi

<div class="form-group">
	<label class="col-md-4 control-label">Username</label>
	<div class="col-md-6">
		<input type="text" class="form-control" name="username" value="{{ old('username') }}">
	</div>
</div>

ganti jadi username

Join the Conversation

2 Comments

Your email address will not be published. Required fields are marked *

  1. ak coba tp tetap tidak bisa. masih ada pesan “The email field is require”
    terimakasih petunjuknya.