InternalMessage.php 827 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class InternalMessage extends Model
  5. {
  6. protected $table = 'internal_message';
  7. public function getRouteKeyName()
  8. {
  9. return 'uid';
  10. }
  11. public function fromPro()
  12. {
  13. return $this->hasOne(Pro::class, 'id', 'from_pro_id');
  14. }
  15. public function toPro()
  16. {
  17. return $this->hasOne(Pro::class, 'id', 'to_pro_id');
  18. }
  19. public function regardingClient()
  20. {
  21. return $this->hasOne(Client::class, 'id', 'regarding_client_id');
  22. }
  23. public function attachments()
  24. {
  25. return $this->hasMany(InternalMessageAttachment::class, 'internal_message_id', 'id');
  26. }
  27. public function videoFile()
  28. {
  29. return $this->hasOne(SystemFile::class, 'id', 'message_video_file_id');
  30. }
  31. }