UserMessage.php 599 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Repositories\Models\Base;
  3. use App\Repositories\Models\Model;
  4. class UserMessage extends Model
  5. {
  6. /**
  7. * @var string
  8. */
  9. protected $table = 'base_user_messages';
  10. protected $guarded = [];
  11. /**
  12. * The attributes excluded from the model's JSON form.
  13. *
  14. * @var array
  15. */
  16. protected $hidden = [];
  17. const IS_READ_OK = 1;
  18. const IS_READ_NO = 0;
  19. public function user()
  20. {
  21. return $this->morphTo('user')->select(['id', 'name']);
  22. }
  23. public function source()
  24. {
  25. return $this->morphTo('source');
  26. }
  27. }