Php 类别';照亮\Mail\Events\MessageSent';未在Laravel 5.4通知中找到
我需要帮助来解决通知系统的问题 这是我的通知类:Php 类别';照亮\Mail\Events\MessageSent';未在Laravel 5.4通知中找到,php,laravel-5,notifications,Php,Laravel 5,Notifications,我需要帮助来解决通知系统的问题 这是我的通知类: <?php namespace App\Notifications; use Illuminate\Bus\Queueable; use Illuminate\Notifications\Notification; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; class Applicatio
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
class ApplicationReceived extends Notification
{
use Queueable;
private $testCode;
private $recipientName;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($testCode='',$name='')
{
$this->testCode=$testCode;
$this->recipientName=$name;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->greeting("Dear ".$this->recipientName)
->subject('Your Application Received for The Entrepreneur')
->line("Your application to participate in The Entrepreneur project has been received by us")
->line("Follow the link below to take a test to complete your application")
->action('Take Test', url('/taketest/'.$this->testCode))
->line('Thank you for your interest in The Entrepreneur project!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
//Notify the candidate
$candidate->notify(new ApplicationReceived($candidate->testcode, $candidate->othernames));
return redirect('/signup')->with('msg', "<div class='alert alert-success'><strong>Your registration information was successfully submitted!</strong><br /> Please check your email for a link to take a test to complete your enrollment!!!</div>");
类照亮\Mail\Events\MessageSent
仅在laravel的最新版本(5.4.18)中添加,因此您可以通过以下方式继续:
运行composer update
,以防上次运行出错
如果错误仍然存在,则可能是权限问题,因此有两种情况:
1) 您使用在供应商目录中没有写入权限的用户运行composer update
,因此您必须使用另一个用户(请参见案例2)
2) 您使用root运行composer update
,但忘记了chown
web服务器用户/组的laravel目录,即:
chmod -R nginx:nginx /path/to/laraveldir
Sobstitutenginx:nginx
与您的Web服务器user:group
在这两种情况下,Web服务器服务的停止和启动也会有所帮助。谢谢@dparoli的建议
但是,我尝试了composer dumpautoload
和composer update
这两种方法都没有效果
事实上,我解决问题的方法与你的建议非常接近。在创建了一个新的laravel项目之后,我意识到它在与MessageSending.php相同的位置包含丢失的文件(MessageSent.php)
所以,我只是在我自己的项目中将文件(MessageSent.php)复制到了同一个文件中,并且成功了。
谢谢你的努力,为我指明了正确的方向
我真的希望这能帮助某人尝试重新运行composer update
和/或运行composer dump autoload
请注意,MessageSent是在4天前的最新版本(5.4.18)中添加的