From dc8e46283b056b11bcef05ff179fc53904113199 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Sun, 6 Apr 2025 17:22:08 +0530 Subject: [PATCH] Redirect to create page after submit --- .../Pages/CreateProductionLineStop.php | 5 +++++ .../Pages/CreateProductionQuantity.php | 5 +++++ .../Pages/CreateQualityValidation.php | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/app/Filament/Resources/ProductionLineStopResource/Pages/CreateProductionLineStop.php b/app/Filament/Resources/ProductionLineStopResource/Pages/CreateProductionLineStop.php index 37ca32d..c711226 100644 --- a/app/Filament/Resources/ProductionLineStopResource/Pages/CreateProductionLineStop.php +++ b/app/Filament/Resources/ProductionLineStopResource/Pages/CreateProductionLineStop.php @@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord; class CreateProductionLineStop extends CreateRecord { protected static string $resource = ProductionLineStopResource::class; + + protected function getRedirectUrl(): string + { + return $this->getResource()::getUrl('create'); // Stay on Create Page after saving + } } diff --git a/app/Filament/Resources/ProductionQuantityResource/Pages/CreateProductionQuantity.php b/app/Filament/Resources/ProductionQuantityResource/Pages/CreateProductionQuantity.php index 0ad7efb..39950ff 100644 --- a/app/Filament/Resources/ProductionQuantityResource/Pages/CreateProductionQuantity.php +++ b/app/Filament/Resources/ProductionQuantityResource/Pages/CreateProductionQuantity.php @@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord; class CreateProductionQuantity extends CreateRecord { protected static string $resource = ProductionQuantityResource::class; + + protected function getRedirectUrl(): string + { + return $this->getResource()::getUrl('create'); // Stay on Create Page after saving + } } diff --git a/app/Filament/Resources/QualityValidationResource/Pages/CreateQualityValidation.php b/app/Filament/Resources/QualityValidationResource/Pages/CreateQualityValidation.php index 8e8da5f..dee80c3 100644 --- a/app/Filament/Resources/QualityValidationResource/Pages/CreateQualityValidation.php +++ b/app/Filament/Resources/QualityValidationResource/Pages/CreateQualityValidation.php @@ -4,6 +4,7 @@ namespace App\Filament\Resources\QualityValidationResource\Pages; use App\Filament\Resources\QualityValidationResource; use Filament\Actions; +use Filament\Forms\Components\Component; use Filament\Resources\Pages\CreateRecord; use Illuminate\Validation\ValidationException; @@ -11,6 +12,7 @@ class CreateQualityValidation extends CreateRecord { protected static string $resource = QualityValidationResource::class; + protected function beforeCreate(): void { $errors = []; @@ -91,4 +93,10 @@ class CreateQualityValidation extends CreateRecord throw ValidationException::withMessages($errors); } } + + protected function getRedirectUrl(): string + { + return $this->getResource()::getUrl('create'); // Stay on Create Page after saving + } + }