加载请求类,因此您正在遇到错误
我需要创建一个自定义登录验证以进行电子邮件验证,我将发布一些摘要以使您对问题有所了解:
但是,我收到以下类应用程序 http controlters auth 请求不存在
堆栈溢出说我需要更多文本,因为它主要是代码,我希望这里的此excpert足以使它颠簸。
登录 - blade- auth随附的默认值,只是调整littleyl
<form class="form-horizontal" method="POST" action="{{ route('loginc') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">Password</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password" required>
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<div class="checkbox">
<label>
<input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}> Remember Me
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-8 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Login
</button>
<a class="btn btn-link" href="{{ route('password.request') }}">
Forgot Your Password?
</a>
</div>
</div>
</form>
logincontroller.php
namespace AppHttpControllersAuth;
use AppHttpControllersAuthRequest;
use AppHttpControllersController;
use IlluminateFoundationAuthAuthenticatesUsers;
class LoginControllerCustom extends Controller
{
use AuthenticatesUsers;
public function login(Request $request)
{
return 'boo';
$this->validateLogin($request);
{
protected function validateLogin(Request $request)
{
$this->validate($request, [
$this->username() => 'required|string|max:150',
'password' => 'required|string|max:150',
]);
}
}
您没有使用所需的名称空间,请尝试在控制器中使用以下内容:
use IlluminateHttpRequest;
由于您的脚本试图从当前名称空间AppHttpControllersAuth
尝试在控制器中添加此行
use IlluminateHttpRequest;
在您的命名空间中使用以下代码或在您的名称空间中包含以找到错误请求:
use IlluminateHttpRequest;