Php 未定义的属性:App\Notifications\NewUserNotification::$id
当数据存储在数据库中,但我想创建通知时,显示通知。发生此错误Php 未定义的属性:App\Notifications\NewUserNotification::$id,php,laravel,notifications,laravel-8,Php,Laravel,Notifications,Laravel 8,当数据存储在数据库中,但我想创建通知时,显示通知。发生此错误 use Queueable; public $user; /** * Create a new notification instance. * * @return void */ public function __construct($user) { $this->user = $user; } public fu
use Queueable;
public $user;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($user)
{
$this->user = $user;
}
public function via($notifiable)
{
return ['database'];
}
public function toDatabase($notifiable)
{
return [
'name' => $this->user->name,
'email' => $this->user->email,
];
}
请共享整个类和使用它的代码。错误还应该告诉您发生错误的确切位置。请在此处共享代码位置。您解决问题了吗?