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.

59 lines
1.4 KiB

2 years ago
  1. <?php
  2. namespace App\Documents;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Jenssegers\Mongodb\Eloquent\Model;
  5. class ModelDocument extends Model
  6. {
  7. use HasFactory, BaseDocument;
  8. protected $connection = 'mongodb';
  9. protected $fillable = [
  10. 'name',
  11. 'labels',
  12. 'publishable',
  13. 'group_id',
  14. 'index_policy',
  15. 'store_policy',
  16. 'get_policy',
  17. 'update_policy',
  18. 'delete_policy',
  19. 'restore_policy',
  20. 'trash_policy',
  21. 'fields',
  22. 'relations'
  23. ];
  24. public function indexPolicy()
  25. {
  26. return $this->belongsTo(PolicyDocument::class, 'index_policy','_id');
  27. }
  28. public function storePolicy()
  29. {
  30. return $this->belongsTo(PolicyDocument::class, 'store_policy','_id');
  31. }
  32. public function updatePolicy()
  33. {
  34. return $this->belongsTo(PolicyDocument::class, 'update_policy','_id');
  35. }
  36. public function getPolicy()
  37. {
  38. return $this->belongsTo(PolicyDocument::class, 'get_policy','_id');
  39. }
  40. public function deletePolicy()
  41. {
  42. return $this->belongsTo(PolicyDocument::class, 'delete_policy','_id');
  43. }
  44. public function restorePolicy()
  45. {
  46. return $this->belongsTo(PolicyDocument::class, 'restore_policy','_id');
  47. }
  48. public function trashPolicy()
  49. {
  50. return $this->belongsTo(PolicyDocument::class, 'trash_policy','_id');
  51. }
  52. }