creation of Notifications table and migration

This commit is contained in:
2025-11-09 18:04:25 +01:00
parent 8341021ba5
commit 3c2128b9b7
5 changed files with 86 additions and 36 deletions
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Notification extends Model
{
protected $fillable = [
'content',
];
public function users(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
return $this->belongsToMany(User::class, 'user_notification', 'notification_id', 'user_id');
}
}
+5
View File
@@ -50,4 +50,9 @@ class User extends Authenticatable
'password' => 'hashed',
];
}
public function notifications(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
return $this->belongsToMany(Notification::class, 'user_notification', 'user_id', 'notification_id');
}
}