首页 > 解决方案 > Laravel 通知类正在通过 Class 'App\Http\Controllers

问题描述

我通过以下方式在 Laravel 上发出了通知:

php artisan notifications:table
php artisan migrate
php artisan make:notification TestNotificationUpdate

表和类创建得很好。

当我使用如下通知时:

/**
 * Store a newly created resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function store(Request $request)
{
    //---- SOME CODE VALIDATION HERE ---- 

    //For testing..
    //Notifying my self
    auth()->user()->notify( new TestNotificationUpdate() );

    //---- SOME CODE STORE DB HERE ---- 
    //---- REDIRECT ---- 
}

我收到错误:

Symfony \ Component \ Debug \ Exception \ FatalThrowableError(E_ERROR)类'App \ Http \ Controllers \ TestNotificationUpdate'未找到

当然,通知类是 on App\Http\**Notifications**\。我不确定我错过了什么。我怎样才能解决这个问题?

提前致谢。

标签: phplaravelnotifications

解决方案


推荐阅读