Я следую инструкциям по уведомлениям в Laravel docs, но я получаю сообщение об ошибке
SQLSTATE[HY000]: General error: 1366 Incorrect integer value:
'caa506cd-a6c6-4907-9a70-81be26324cf3'
for column 'notifiable_id' at row 1
(SQL: insert into `notifications` (
`id`,
`type`,
`data`,
`read_at`,
`notifiable_id`,
`notifiable_type`,
`updated_at`,
`created_at`
) values (
18983710-8eaf-4784-8015-63c078e93866,
App\Notifications\UserSelectedToInterview,
{"company_name":"McDonalds","job_title":null},
,
caa506cd-a6c6-4907-9a70-81be26324cf3,
App\User,
2018-09-23 16:20:24, 2018-09-23 16:20:24)
)
, когда я звоню
// Create the notification for the users
Notification::send(User::whereIn('id', $candidates->pluck('user_id'))
->select('id')
->get(),
new UserSelectedToInterview($loggedCompany->name, $job->title));
С моей миграцией уведомлений:
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();
});
Я предполагаю, что $table->morphs('notifiable');
ожидает int
, но моя модель User
использует в качестве первичного ключа uuid
.
В моей User
модели, которую я указал с protected $keyType = 'string';
Есть идеи, где проблема?