Added queryException while submit record
This commit is contained in:
@@ -5,8 +5,90 @@ namespace App\Filament\Resources\QualityValidationResource\Pages;
|
|||||||
use App\Filament\Resources\QualityValidationResource;
|
use App\Filament\Resources\QualityValidationResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions;
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
|
||||||
class CreateQualityValidation extends CreateRecord
|
class CreateQualityValidation extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = QualityValidationResource::class;
|
protected static string $resource = QualityValidationResource::class;
|
||||||
|
|
||||||
|
protected function beforeCreate(): void
|
||||||
|
{
|
||||||
|
$errors = [];
|
||||||
|
|
||||||
|
if (!empty($this->data['validationError'])) {
|
||||||
|
$errors['validationError'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->data['pack_slip_motor_error'])) {
|
||||||
|
$errors['pack_slip_motor_error'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->data['pack_slip_pump_error'])) {
|
||||||
|
$errors['pack_slip_pump_error'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->data['pack_slip_pumpset_error'])) {
|
||||||
|
$errors['pack_slip_pumpset_error'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//..name plate
|
||||||
|
|
||||||
|
if (!empty($this->data['name_plate_motor_error'])) {
|
||||||
|
$errors['name_plate_motor_error'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->data['name_plate_pump_error'])) {
|
||||||
|
$errors['name_plate_pump_error'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->data['name_plate_pumpset_error'])) {
|
||||||
|
$errors['name_plate_pumpset_error'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//..tube sticker
|
||||||
|
|
||||||
|
if (!empty($this->data['tube_sticker_motor_error'])) {
|
||||||
|
$errors['tube_sticker_motor_error'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->data['tube_sticker_pump_error'])) {
|
||||||
|
$errors['tube_sticker_pump_error'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->data['tube_sticker_pumpset_error'])) {
|
||||||
|
$errors['tube_sticker_pumpset_error'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//..warranty
|
||||||
|
if (!empty($this->data['warranty_card_error'])) {
|
||||||
|
$errors['warranty_card_error'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//..part validations
|
||||||
|
|
||||||
|
if (!empty($this->data['part_validation1_error'])) {
|
||||||
|
$errors['part_validation1_error'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->data['part_validation2_error'])) {
|
||||||
|
$errors['part_validation2_error'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->data['part_validation3_error'])) {
|
||||||
|
$errors['part_validation3_error'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->data['part_validation4_error'])) {
|
||||||
|
$errors['part_validation4_error'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->data['part_validation5_error'])) {
|
||||||
|
$errors['part_validation5_error'] = ['Fix the errors before submitting.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!empty($errors)) {
|
||||||
|
throw ValidationException::withMessages($errors);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user