Laravel 5.8使用布局变量重置密码邮件不起作用

问题描述 投票:1回答:1

我正在使用Laravel 5.8默认身份验证系统。我有布局文件,其中有来自类别模型和控制器的变量。我需要将此布局文件与身份验证系统刀片合并。到目前为止,登录和注册工作正常。我在LoginController中添加了:

    public function showLoginForm(){

      $categories = Category::all();
      return view('auth.login', compact('categories'));
    }

此外,我还在方法“ showRegistrationForm”中的RegisterController中添加了相同的代码。

下一个是“ forgotPasswordController”,在这里我开始出现错误。我在方法“ showLinkRequestForm”中添加了相同的代码,并且显示了表单,但是未提交,我遇到此错误-

调用未定义方法App \ User :: notify()

我在我的用户模型中使用的是什么:

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
use TCG\Voyager\Contracts\User as UserContract;
use TCG\Voyager\Traits\VoyagerUser;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable implements UserContract
{
    use VoyagerUser;
php laravel-5.8
1个回答
0
投票

然后确保您正确执行了以下步骤-

  • 在您的用户模型中添加可通知的列车。
Illuminate\Notifications\Notifiable

在app.php中添加:供您的提供商使用:

Illuminate\Notifications\NotificationServiceProvider::class,

在别名中:

'Notification' => Illuminate\Support\Facades\Notification::class,

© www.soinside.com 2019 - 2024. All rights reserved.