Note.php 875 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 sections()
  28. {
  29. return $this->hasMany(Section::class, 'note_id', 'id')
  30. ->where('is_active', true)
  31. ->orderBy('position_index', 'asc');
  32. }
  33. }