Files
pds/app/Filament/Resources/LineResource/Pages/CreateLine.php

81 lines
2.5 KiB
PHP

<?php
namespace App\Filament\Resources\LineResource\Pages;
use App\Filament\Resources\LineResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
use Illuminate\Validation\ValidationException;
class CreateLine extends CreateRecord
{
protected static string $resource = LineResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
protected function beforeCreate(): void
{
$errors = [];
if (!empty($this->data['lPlantError'])) {
$errors['lPlantError'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['lNameError'])) {
$errors['lNameError'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['lTypeError'])) {
$errors['lTypeError'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['work_group1_id_error'])) {
$errors['work_group1_id_error'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['work_group2_id_error'])) {
$errors['work_group2_id_error'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['work_group3_id_error'])) {
$errors['work_group1_id_error'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['work_group4_id_error'])) {
$errors['work_group4_id_error'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['work_group5_id_error'])) {
$errors['work_group5_id_error'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['work_group6_id_error'])) {
$errors['work_group6_id_error'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['work_group7_id_error'])) {
$errors['work_group7_id_error'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['work_group8_id_error'])) {
$errors['work_group8_id_error'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['work_group9_id_error'])) {
$errors['work_group9_id_error'] = ['Fix the errors before submitting.'];
}
//..warranty
if (!empty($this->data['work_group10_id_error'])) {
$errors['work_group10_id_error'] = ['Fix the errors before submitting.'];
}
if (!empty($errors)) {
throw ValidationException::withMessages($errors);
}
}
}