messages implemented
This commit is contained in:
62
app/Models/ConversationParticipant.php
Normal file
62
app/Models/ConversationParticipant.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $conversation_id
|
||||
* @property int $user_id
|
||||
* @property string $role member|admin
|
||||
* @property \Carbon\Carbon|null $last_read_at
|
||||
* @property bool $is_muted
|
||||
* @property bool $is_archived
|
||||
* @property bool $is_pinned
|
||||
* @property \Carbon\Carbon|null $pinned_at
|
||||
* @property \Carbon\Carbon $joined_at
|
||||
* @property \Carbon\Carbon|null $left_at
|
||||
*/
|
||||
class ConversationParticipant extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'conversation_id',
|
||||
'user_id',
|
||||
'role',
|
||||
'last_read_at',
|
||||
'is_muted',
|
||||
'is_archived',
|
||||
'is_pinned',
|
||||
'pinned_at',
|
||||
'joined_at',
|
||||
'left_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'last_read_at' => 'datetime',
|
||||
'is_muted' => 'boolean',
|
||||
'is_archived' => 'boolean',
|
||||
'is_pinned' => 'boolean',
|
||||
'pinned_at' => 'datetime',
|
||||
'joined_at' => 'datetime',
|
||||
'left_at' => 'datetime',
|
||||
];
|
||||
|
||||
// ── Relationships ────────────────────────────────────────────────────────
|
||||
|
||||
public function conversation(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Conversation::class);
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user