Add initial Code
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreCustomerRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true; // Autorisierung später über Policies/Gates
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'type' => 'required|in:private,business',
|
||||
'company_name' => [
|
||||
'required_if:type,business',
|
||||
'nullable',
|
||||
'string',
|
||||
'max:100',
|
||||
],
|
||||
'first_name' => 'required|string|max:50',
|
||||
'last_name' => 'required|string|max:50',
|
||||
'email' => 'required|email|unique:customers,email|max:100',
|
||||
'phone' => 'nullable|string|max:20',
|
||||
'tax_number' => 'nullable|string|max:50',
|
||||
'vat_id' => 'nullable|string|max:50',
|
||||
'billing_address' => 'required|array',
|
||||
'billing_address.street' => 'required|string|max:100',
|
||||
'billing_address.city' => 'required|string|max:50',
|
||||
'billing_address.postal_code' => 'required|string|max:10',
|
||||
'billing_address.country' => 'required|string|size:2',
|
||||
'payment_terms' => 'nullable|integer|min:1',
|
||||
'status' => 'nullable|in:active,inactive,prospect',
|
||||
'notes' => 'nullable|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user