- M-2: Produktionen buchen Bestand — StoreProductionRequest verlangt
jetzt admin >= 7 (wie manuelle Bestandsbewegungen); create/edit/copy
im Controller gegated, UI-Buttons für niedrigere Stufen ausgeblendet.
- M-3: Ausschuss-/Bewegungs-/Produktions-Buttons nur noch für
Berechtigte sichtbar (keine toten Formulare mehr).
- M-6: Zustandsändernde GET-Routen umgestellt — stock-entries/copy
jetzt POST mit CSRF; /admin/product/delete jetzt DELETE-Formulare
(Produktliste + Rezeptur-Zeile im Produktformular).
- M-7: ProductController::imageAttribute whitelistet Spalten
('active', 'pos') + numerische Werte, sonst 400 — kein beliebiger
Spalten-Write per URL mehr.
- M-10: URL-Felder (Lieferant, Verpackungsartikel, INCI-Lieferanten-
Repeater) validieren url:http,https — keine speicherbaren
javascript:-Links mehr.
Tests: ProductionHardeningTest +2; drei bestehende Tests an neue
Regeln angepasst (admin-Level 7 für Produktions-Formular, POST-Copy).
Suite: 231 grün.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
45 lines
1.6 KiB
PHP
45 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Inventory;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateSupplierRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array<int, mixed>>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => ['required', 'string', 'max:255'],
|
|
'url' => ['nullable', 'string', 'url:http,https', 'max:2048'],
|
|
'order_method' => ['nullable', 'in:email,online_shop'],
|
|
'order_email' => ['nullable', 'email', 'max:255'],
|
|
'order_url' => ['nullable', 'string', 'url:http,https', 'max:2048'],
|
|
'delivery_time' => ['nullable', 'string', 'max:255'],
|
|
'delivery_time_days' => ['nullable', 'integer', 'min:0', 'max:65535'],
|
|
'contact_person' => ['nullable', 'string', 'max:255'],
|
|
'email' => ['nullable', 'email', 'max:255'],
|
|
'phone' => ['nullable', 'string', 'max:100'],
|
|
'country_id' => ['required', 'integer', 'exists:countries,id'],
|
|
'notes' => ['nullable', 'string'],
|
|
'active' => ['sometimes', 'boolean'],
|
|
'supplier_category_ids' => ['nullable', 'array'],
|
|
'supplier_category_ids.*' => ['integer', 'exists:supplier_categories,id'],
|
|
];
|
|
}
|
|
|
|
protected function prepareForValidation(): void
|
|
{
|
|
$this->merge([
|
|
'active' => $this->boolean('active'),
|
|
'delivery_time_days' => $this->input('delivery_time_days', '') === '' ? null : $this->input('delivery_time_days'),
|
|
]);
|
|
}
|
|
}
|