You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
502 B

2 years ago
  1. <?php
  2. namespace App\Documents;
  3. trait BaseDocument
  4. {
  5. public function getAppend()
  6. {
  7. return array_merge($this->appends, ['id']);
  8. }
  9. public function getHidden()
  10. {
  11. return array_merge($this->hidden, ['_id']);
  12. }
  13. public function setIdAttribute($value)
  14. {
  15. $this->attributes['_id'] = $value;
  16. }
  17. public function scopeWithoutTrash($q)
  18. {
  19. return $q->where(fn ($q) => $q->where('deleted_at', null)->orWhere('deleted_at', ''));
  20. }
  21. }