feat: Implement read cursor activity tracking and recent activity dashboard with context
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
class ReadCursor extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'cursorable_id',
|
||||
'cursorable_type',
|
||||
'read_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'read_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function cursorable(): MorphTo
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,11 @@ class User extends Authenticatable implements PasskeyUser
|
||||
return $this->hasMany(Mutation::class);
|
||||
}
|
||||
|
||||
public function readCursors()
|
||||
{
|
||||
return $this->hasMany(ReadCursor::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user