13-05-2026 Waren Wirtschaft

This commit is contained in:
Kevin Adametz 2026-05-13 18:09:20 +02:00
parent 9ce711d6b2
commit ca3eb663fe
40 changed files with 1000 additions and 189 deletions

View file

@ -3,6 +3,7 @@
namespace App\Http\Requests\Inventory;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class ReceiveStockEntryRequest extends FormRequest
{
@ -31,4 +32,19 @@ class ReceiveStockEntryRequest extends FormRequest
'received_quantity' => reFormatNumber($this->input('received_quantity')),
]);
}
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator): void {
$stockEntry = $this->route('stockEntry') ?? $this->route('stock_entry');
if ($stockEntry && $stockEntry->entry_type === 'ingredient') {
if (empty($this->input('batch_number'))) {
$validator->errors()->add('batch_number', __('Bitte eine Chargennummer angeben.'));
}
if (empty($this->input('best_before'))) {
$validator->errors()->add('best_before', __('Bitte die Mindesthaltbarkeit angeben.'));
}
}
});
}
}