Abo Einmalprodukte und Bestätigung abschließen
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
2bdc9ada3c
commit
2269ce031f
57 changed files with 3647 additions and 371 deletions
42
app/Http/Requests/Abo/AboOneTimeItemRequest.php
Normal file
42
app/Http/Requests/Abo/AboOneTimeItemRequest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Abo;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AboOneTimeItemRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array<int, mixed>>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'action' => ['required', 'in:add,update,remove,confirm,discard'],
|
||||
'product_id' => ['required_if:action,add', 'integer', 'exists:products,id'],
|
||||
'one_time_item_id' => ['required_if:action,update,remove', 'integer', 'exists:user_abo_one_time_items,id'],
|
||||
'qty' => ['required_if:action,update', 'integer', 'min:1', 'max:100'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'action.required' => __('abo.onetime_action_required'),
|
||||
'action.in' => __('abo.onetime_action_invalid'),
|
||||
'product_id.required_if' => __('abo.product_not_found'),
|
||||
'product_id.exists' => __('abo.product_not_found'),
|
||||
'one_time_item_id.required_if' => __('abo.abo_item_not_found'),
|
||||
'one_time_item_id.exists' => __('abo.abo_item_not_found'),
|
||||
'qty.required_if' => __('abo.onetime_qty_required'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue