I'm trying to create a database notifcation in Laravel 5.7 and getting this SQL QueryException. My $notifiable variable in the toArray method is the user and this id in the exception: invalid input syntax for integer: \"10337e35-8da9-4600-b7de-792398eb6f48\"
is the correct id for the user to be notified. I have my notifications table set up in the standard way:
Schema::create('notifications', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('type');
$table->morphs('notifiable');
$table->text('data');
$table->timestamp('read_at')->nullable();
$table->timestamps();
});
My user table is set up like this:
Schema::create('users', function (Blueprint $table) {
$table->uuid('id');
$table->primary('id');
$table->string('name');
$table->string('username')->unique();
$table->string('email');
$table->string('password');
$table->rememberToken();
$table->timestamps();
$table->softDeletes();
});
It is set up with a uuid as the primary id. Beyond that, the notification itself has database
in the via method:
public function via($notifiable)
{
return ['database', 'mail'];
}
I've set a couple properties in the toArray method. Nothing complicated. I'm not seeing the logical cause for this exception.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire