Conversation.php 389 B

1234567891011121314151617181920
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Conversation extends Model
  5. {
  6. public function messages(){
  7. return $this->hasMany(Message::class);
  8. }
  9. public function sender(){
  10. return $this->belongsTo(User::class, 'sender_id');
  11. }
  12. public function receiver(){
  13. return $this->belongsTo(User::class, 'receiver_id');
  14. }
  15. }