wip
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\GlobalOrder\Controllers\Requests;
|
||||
|
||||
use App\Models\Ecommerce\Product\Order\Payment\OrderPayment;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Validation\Rules\File as FileRule;
|
||||
|
||||
class GlobalOrderStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'customer_name' => ['required', 'string', 'max:255'],
|
||||
'customer_phone' => ['required', 'integer', 'between:61000000,71999999'],
|
||||
'customer_address' => ['nullable', 'string', 'max:255'],
|
||||
'payment_type' => ['required', 'string', Rule::in(array_keys(OrderPayment::oldButGoodTypes()))],
|
||||
'notes' => ['nullable', 'string', 'max:255'],
|
||||
'order_website' => ['nullable', 'string', 'max:255'],
|
||||
'images.*' => ['nullable', FileRule::image()->min('1kb')->max('10mb')],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the error messages for the defined validation rules.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'payment_type.in' => sprintf('Valid sources: %s', implode(', ', array_keys(
|
||||
OrderPayment::oldButGoodTypes()
|
||||
))),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user