2017-07-18 53 views
0

我想改變notification表的名稱更改默認的通知表的名稱,所以我改變了遷移文件:如何Laravel

php artisan notification:table 

Schema::create('member_notifications', function (Blueprint $table) { 
     $table->uuid('id')->primary(); 
     $table->string('type'); 
     $table->morphs('notifiable'); 
     $table->text('data'); 
     $table->timestamp('read_at')->nullable(); 
     $table->timestamps(); 
}); 

,並試圖在Notification類使用$table

protected $table = 'member_notifications'; 

但是,當我試圖在數據庫中存儲通知時,出現此錯誤:

SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "notifications" does not exist 

回答

0

去供應商/ laravel /框架/ src目錄/照亮/通知/ DatabaseNotification.php

,改變保護$表所需的表名

你的情況

protected $table = 'member_notifications'; 
+0

謝謝,但這不是一個穩定的解決方案,因爲更新後我應該再次編輯這個文件 – MajAfy