packages/notifications/src/Models/Notification.php
<?php
namespace Moox\Notification\Models;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class Notification extends Model
{
use HasUuids;
protected $keyType = 'string';
public $incrementing = false;
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
if (empty($model->id)) {
$model->id = (string) Str::uuid();
}
});
}
protected $table = 'notifications';
protected $fillable = [
'type',
'notifiable_type',
'notifiable_id',
'data',
'read_at',
];
}