v1.4.0
This commit is contained in:
28
app/Models/Notification.php
Normal file
28
app/Models/Notification.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Observers\NotificationObserver;
|
||||
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
|
||||
|
||||
#[ObservedBy([NotificationObserver::class])]
|
||||
class Notification extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'title',
|
||||
'body',
|
||||
'url',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function markAsRead()
|
||||
{
|
||||
$this->read_at = now();
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user