Laravel 5.4类App \ Http \ Controllers \ Auth \ Request不存在

The*_*Guy 1 php laravel-5.4

我需要为电子邮件验证创建自定义登录身份验证,我将发布一些代码片段以使您对问题有所了解:

但是,我收到以下类App \ Http \ Controllers \ Auth \ Request不存在

堆栈溢出表示我需要更多文本,因为它主要是代码,我希望这里的摘录足以使它崩溃。

login.blade-身份验证随附的默认值,只是对美梦音进行了调整

<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>
Run Code Online (Sandbox Code Playgroud)

loginController.php

namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Auth\Request;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

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',
    ]);
}
}
Run Code Online (Sandbox Code Playgroud)

小智 5

您没有使用必需的名称空间,请尝试在控制器中使用以下名称:

use Illuminate\Http\Request;
Run Code Online (Sandbox Code Playgroud)

由于脚本试图从当前名称空间加载Request类,导致出现错误 App\Http\Controllers\Auth