查看[auth.login]未找到laravel 5

Sak*_*arg 5 laravel

我在routes.php文件中创建了路由

路线::控制器( 'AUTH', '验证\ AuthController');

Auth/AuthController.php文件是

<?php

namespace App\Http\Controllers\Auth;

use App\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Contracts\Auth\Guard;

use App\Http\Requests\Auth\LoginRequest;
use App\Http\Requests\Auth\RegisterRequest;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;

class AuthController extends Controller
{

use AuthenticatesAndRegistersUsers, ThrottlesLogins;

    /**
 * the model instance
 * @var User
 */
protected $user; 
/**
 * The Guard implementation.
 *
 * @var Authenticator
 */
protected $auth;

/**
 * Create a new authentication controller instance.
 *
 * @return void
 */
public function __construct(Guard $auth, User $user)
{

    $this->user = $user; 
    $this->auth = $auth;

    $this->middleware('guest', ['except' => ['getLogout']]); 
}

/**
 * Show the application registration form.
 *
 * @return Response
 */
public function getRegister()
{
    return view('auth.register');
}

/**
 * Handle a registration request for the application.
 *
 * @param  RegisterRequest  $request
 * @return Response
 */
public function postRegister(RegisterRequest $request)
{
    //code for registering a user goes here.
    $this->auth->login($this->user); 
    return redirect('/todo'); 
}

/**
 * Show the application login form.
 *
 * @return Response
 */
public function getLogin()
{
    return view('auth.login');
}

/**
 * Handle a login request to the application.
 *
 * @param  LoginRequest  $request
 * @return Response
 */
public function postLogin(LoginRequest $request)
{
    if ($this->auth->attempt($request->only('email', 'password')))
    {
        return redirect('/todo');
    }

    return redirect('/login')->withErrors([
        'email' => 'The credentials you entered did not match our records. Try again?',
    ]);
}

/**
 * Log the user out of the application.
 *
 * @return Response
 */
public function getLogout()
{
    $this->auth->logout();

    return redirect('/');
}
}
Run Code Online (Sandbox Code Playgroud)

当我点击此身份验证/登录时,它会给我错误 - FileViewFinder.php第137行中的InvalidArgumentException:找不到视图[auth.login].任何人都可以帮我解决这个问题.

luc*_*980 20

引导/缓存

并将config.php重命名为config.php_

我很确定你已经从另一个网站复制并移动了缓存

  • 您可以删除旧的,这只是为了保留备份。 (2认同)

小智 6

如果您只是开始一个新项目,则没有开箱即用的身份验证视图,就像上面提到的Peter Fox一样。

您将需要输入

php artisan make:auth
Run Code Online (Sandbox Code Playgroud)

创建这些视图。


小智 5

当我们要进行全新设置时,可能会发生这种情况。先尝试清洁

php artisan view:clear

php artisan config:cache

php artisan route:cache
Run Code Online (Sandbox Code Playgroud)


fem*_*izo 2

i got mine to work after modifing the auth.login directroy from /Auth to /auth can be located at laravel/resources/views/Auth