diff --git a/app/Http/Controllers/V2/Exports/ExportAllMonitoredEntitiesController.php b/app/Http/Controllers/V2/Exports/ExportAllMonitoredEntitiesController.php index 5104b984c..ded1eb6fa 100644 --- a/app/Http/Controllers/V2/Exports/ExportAllMonitoredEntitiesController.php +++ b/app/Http/Controllers/V2/Exports/ExportAllMonitoredEntitiesController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\V2\Exports; use App\Http\Controllers\Controller; +use App\Models\Framework; use App\Models\V2\Forms\Form; use App\Models\V2\Nurseries\Nursery; use App\Models\V2\Nurseries\NurseryReport; @@ -20,6 +21,7 @@ class ExportAllMonitoredEntitiesController extends Controller public function __invoke(Request $request, string $entity, string $framework) { $modelClass = $this->getModelClass($entity); + $framework = $this->getSlug($framework); $form = $this->getForm($modelClass, $framework); $this->authorize('export', [$modelClass, $form]); @@ -36,6 +38,11 @@ public function __invoke(Request $request, string $entity, string $framework) ]); } + private function getSlug(string $framework) + { + $frameworkModel = Framework::where('access_code', $framework)->firstOrFail(); + return $frameworkModel->slug; + } private function getForm(string $modelClass, string $framework) { return Form::where('model', $modelClass)