Initial commit for new repo
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m4s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m4s
This commit is contained in:
80
app/Filament/Resources/LineResource/Pages/CreateLine.php
Normal file
80
app/Filament/Resources/LineResource/Pages/CreateLine.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user