ApprovalFlowObjectType.php 955 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\Models\Enums;
  3. use App\Models\Asset;
  4. use App\Models\Container;
  5. use App\Models\Plan;
  6. use App\Models\Project;
  7. use App\Models\Requirement;
  8. use App\Models\Task;
  9. use App\Services\History\Detector\AssetDetector;
  10. use App\Services\History\Detector\ContainerContentDetector;
  11. use App\Services\History\Detector\ContainerDetector;
  12. use App\Services\History\Detector\ProjectDetector;
  13. use App\Services\History\Detector\RequirementDetector;
  14. use App\Services\History\Detector\TaskDetector;
  15. enum ApprovalFlowObjectType: string
  16. {
  17. case PROJECT = "project";
  18. public function modelBuilder(): \Illuminate\Database\Eloquent\Builder
  19. {
  20. return match ($this) {
  21. self::PROJECT => Project::query(),
  22. };
  23. }
  24. public function modelBuilderAllowed(string $id = null): \Illuminate\Database\Eloquent\Builder
  25. {
  26. return match ($this) {
  27. self::PROJECT => Project::query()->allowed($id),
  28. };
  29. }
  30. }