Segment.php 851 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Models;
  3. # use Illuminate\Database\Eloquent\Model;
  4. class Segment extends Model
  5. {
  6. protected $table = 'segment';
  7. public function segmentTemplate() {
  8. return $this->hasOne(SegmentTemplate::class, 'id', 'segment_template_id');
  9. }
  10. public function note() {
  11. return $this->hasOne(Note::class, 'id', 'note_id');
  12. }
  13. public function client() {
  14. return $this->hasOne(Client::class, 'id', 'client_id');
  15. }
  16. public function shortName(){
  17. return trim(array_reverse(explode('>', $this->display_title))[0]);
  18. }
  19. public function summarySuggestions()
  20. {
  21. return $this->hasMany(SegmentSummarySuggestion::class, 'segment_id', 'id');
  22. }
  23. public function summaryUpdates()
  24. {
  25. return $this->hasMany(SegmentSummaryUpdate::class, 'segment_id', 'id');
  26. }
  27. }