April 2026 waren Wirtschaft Feedback
This commit is contained in:
parent
02f2a4c23e
commit
9ce711d6b2
167 changed files with 25278 additions and 8518 deletions
45
app/Http/Requests/Inventory/UpdatePackagingItemRequest.php
Normal file
45
app/Http/Requests/Inventory/UpdatePackagingItemRequest.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Inventory;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdatePackagingItemRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array<int, mixed>>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'packaging_material_id' => ['required', 'integer', 'exists:packaging_materials,id'],
|
||||
'supplier_id' => ['nullable', 'integer', 'exists:suppliers,id'],
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'category' => ['required', Rule::in(['packaging', 'shipping', 'label', 'shipping_office'])],
|
||||
'weight_grams' => ['nullable', 'numeric', 'min:0'],
|
||||
'min_stock_alert' => ['nullable', 'integer', 'min:0'],
|
||||
'url' => ['nullable', 'url', 'max:500'],
|
||||
'product_id' => ['nullable', 'integer', 'exists:products,id'],
|
||||
'active' => ['sometimes', 'boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
'active' => $this->boolean('active'),
|
||||
]);
|
||||
|
||||
foreach (['supplier_id', 'product_id', 'min_stock_alert'] as $key) {
|
||||
if ($this->input($key) === '' || $this->input($key) === null) {
|
||||
$this->merge([$key => null]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue