【问题标题】:Laravel 5.7 Class App\Http\Controllers\Auth\SendsPasswordResetEmails does not existLaravel 5.7 类 App\Http\Controllers\Auth\SendsPasswordResetEmails 不存在
【发布时间】:2019-03-07 17:26:45
【问题描述】:

我正在尝试使用 Laravel 5.7 中的内置函数来实现重置密码功能,因为我在 web.php 中定义了我的路由。我尝试运行 php artisan route:list ,它给了我一个例外

更新

抱歉,没有提供任何信息。我之前已经运行了命令php artisan make:auth,并且Auth::routes() 已经在web.php 中定义我正在尝试通过我的ResetPasswords 特征访问resets 中的函数ResetPasswordController,但它给出了一个异常

类 App\Http\Controllers\ResetPasswordController 不存在

我正在使用位于 App\Http\Controllers\Auth\ResetPasswor.php 的预定义控制器

重置密码控制器

<?php

namespace App\Http\Controllers\Auth;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;

class ResetPasswordController extends Controller
{

    use ResetsPasswords;


    public function reset(Request $request){
        $reset = $this->reset($request);
    }

    /**
     * Where to redirect users after resetting their password.
     *
     * @var string
     */
    protected $redirectTo = '/home';

    /**
     * Create a new controller instance.
     *
     * @return void
     */

    public function __construct()
    {
    $this->middleware('guest');
    }
}

web.php

Auth::routes();


Route::post('password/reset','ResetPasswordController@reset');

【问题讨论】:

  • 错误说在您的 Auth 文件夹中找不到 SendsPasswordResetEmails 检查此
  • 检查你丢失的类的命名空间是否正确
  • 你有没有运行php artisan make:auth 让 Laravel 生成这些类?根据this 还要确保你调用了正确的类,除非你做了一些自定义的,它们应该是Auth\ForgotPasswordControllerAuth\ResetPasswordController

标签: php laravel laravel-5 laravel-5.7


【解决方案1】:

解决方案

我发现我哪里做错了,我不得不在我的路线中添加一个Auth\

Route::post('password/reset','Auth\ResetPasswordController@reset');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-04
    • 1970-01-01
    • 2020-05-01
    • 2021-10-21
    • 2021-09-25
    • 2015-05-10
    相关资源
    最近更新 更多