feat: chat en tiempo real bidireccional funcionando con Reverb

This commit is contained in:
2026-04-26 02:15:21 -06:00
parent 2de99b8cd2
commit ab967e8ba4
15 changed files with 352 additions and 392 deletions
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Friendship extends Model
{
protected $fillable = [
'sender_id',
'receiver_id',
'status',
];
public function sender()
{
return $this->belongsTo(User::class, 'sender_id');
}
public function receiver()
{
return $this->belongsTo(User::class, 'receiver_id');
}
}
+16 -4
View File
@@ -7,13 +7,25 @@ use Illuminate\Database\Eloquent\Model;
class Message extends Model
{
protected $fillable = [
'conversation_id',
'user_id',
'message'
'receiver_id',
'body',
'attachment',
'attachment_type',
'read_at',
];
public function user()
protected $casts = [
'read_at' => 'datetime',
];
public function sender()
{
return $this->belongsTo(User::class);
return $this->belongsTo(User::class, 'user_id');
}
public function receiver()
{
return $this->belongsTo(User::class, 'receiver_id');
}
}