我正在使用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;
然后确保您正确执行了以下步骤-
Illuminate\Notifications\Notifiable
在app.php中添加:供您的提供商使用:
Illuminate\Notifications\NotificationServiceProvider::class,
在别名中:
'Notification' => Illuminate\Support\Facades\Notification::class,