InternalMessage.php 954 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 regardingCompany()
  24. {
  25. return $this->hasOne(Client::class, 'id', 'regarding_company_id');
  26. }
  27. public function attachments()
  28. {
  29. return $this->hasMany(InternalMessageAttachment::class, 'internal_message_id', 'id');
  30. }
  31. public function videoFile()
  32. {
  33. return $this->hasOne(SystemFile::class, 'id', 'message_video_file_id');
  34. }
  35. }