Added queryException while submit record
This commit is contained in:
@@ -5,8 +5,20 @@ namespace App\Filament\Resources\StickerMasterResource\Pages;
|
|||||||
use App\Filament\Resources\StickerMasterResource;
|
use App\Filament\Resources\StickerMasterResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions;
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
|
||||||
class CreateStickerMaster extends CreateRecord
|
class CreateStickerMaster extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = StickerMasterResource::class;
|
protected static string $resource = StickerMasterResource::class;
|
||||||
|
|
||||||
|
protected function beforeCreate(): void
|
||||||
|
{
|
||||||
|
$errors = [];
|
||||||
|
|
||||||
|
if (!empty($this->data['item_error'])) {
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'item_id' => 'Fix the errors before submitting.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user