id(); $table->unsignedBigInteger('user_id'); $table->string('notification_code'); $table->string('title'); $table->text('message'); $table->string('link')->nullable(); $table->boolean('is_read')->default(false); $table->timestamps(); // Foreign key constraint $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); // Indexes for better performance $table->index(['user_id', 'is_read']); $table->index('notification_code'); $table->index('created_at'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('notifications'); } }