Note.php 1017 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Models;
  3. # use Illuminate\Database\Eloquent\Model;
  4. class Note extends Model
  5. {
  6. protected $table = "note";
  7. public function client()
  8. {
  9. return $this->hasOne(Client::class, 'id', 'client_id');
  10. }
  11. public function hcpPro()
  12. {
  13. return $this->hasOne(Pro::class, 'id', 'hcp_pro_id');
  14. }
  15. public function createdSession()
  16. {
  17. return $this->hasOne(AppSession::class, 'id', 'created_by_session_id');
  18. }
  19. public function allyPro()
  20. {
  21. return $this->hasOne(Pro::class, 'id', 'ally_pro_id');
  22. }
  23. public function bills()
  24. {
  25. return $this->hasMany(Bill::class, 'note_id', 'id');
  26. }
  27. public function addendums()
  28. {
  29. return $this->hasMany(NoteAddendum::class, 'note_id', 'id')->where('is_removed', false);
  30. }
  31. public function sections()
  32. {
  33. return $this->hasMany(Section::class, 'note_id', 'id')
  34. ->where('is_active', true)
  35. ->orderBy('position_index', 'asc');
  36. }
  37. }