What does your User table look like? Is there any more to that message, like a stack trace or raw SQL query?
Dec 12, 2017
4
Level 2
Unknown column 'id' in 'field list' - Laravel Notifications
I have been trying to understand why is this error appearing. This is my first time with Laravel's notification system and I'm getting the error above. I have been following the docummentation on Laravel's website but I can't seem to get the grip of this error.
JobDenied
public function via($notifiable)
{
return ['database'];
}
public function toDatabase($notifiable)
{
return [
'deniedTime' => Carbon::now()
];
}
public function toArray($notifiable)
{
return [
//
];
}
Notification tables
// Generate using php artisan notifications:table
Schema::create('notifications', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('type');
$table->morphs('php ');
$table->text('data');
$table->timestamp('read_at')->nullable();
$table->timestamps();
});
Invonking the notification
$sendToUser = User::find(2);
$sendToUser->notify(new JobDenied());
Any thoughts? I have no idea how to debug this
Level 28
You need to change $table->morphs('php '); in your notifications migration to $table->morphs('notifiable');
1 like
Please or to participate in this conversation.