migrate to gtea from bistbucket
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Http\Requests\Coupon;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class CouponStoreRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:100'],
|
||||
'added_by' => 'nullable|string|max:255',
|
||||
'discount_type' => ['required', Rule::in(['fixed', 'percentage', 'free_delivery'])],
|
||||
'coupon_type' => ['required', Rule::in(['restaurant', 'hotel', 'both'])],
|
||||
'amount' => [
|
||||
'required_if:discount_type,fixed,percentage',
|
||||
'nullable',
|
||||
'numeric',
|
||||
'min:0',
|
||||
'max:1000000', // optional upper limit
|
||||
],
|
||||
'valid_from' => 'nullable|date|before_or_equal:valid_to',
|
||||
'valid_to' => 'nullable|date|after_or_equal:valid_from',
|
||||
'usage_limit' => 'nullable|integer|min:0',
|
||||
'max_uses_per_customer' => 'nullable|integer|min:0',
|
||||
'min_order_amount' => 'nullable|numeric|min:0',
|
||||
'image' => 'nullable',
|
||||
'source' => 'nullable|string|max:255',
|
||||
'status' => 'nullable|integer|in:0,1', // 1=Active, 0=Inactive
|
||||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Http\Requests\Coupon;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class CouponUpdateRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:100'],
|
||||
'added_by' => 'nullable|string|max:255',
|
||||
'discount_type' => ['required', Rule::in(['fixed', 'percentage', 'free_delivery'])],
|
||||
'coupon_type' => ['required', Rule::in(['restaurant', 'hotel', 'both'])],
|
||||
'amount' => [
|
||||
'required_if:discount_type,fixed,percentage',
|
||||
'nullable',
|
||||
'numeric',
|
||||
'min:0',
|
||||
'max:1000000', // optional upper limit
|
||||
],
|
||||
'valid_from' => 'nullable|date|before_or_equal:valid_to',
|
||||
'valid_to' => 'nullable|date|after_or_equal:valid_from',
|
||||
'usage_limit' => 'nullable|integer|min:0',
|
||||
'max_uses_per_customer' => 'nullable|integer|min:0',
|
||||
'min_order_amount' => 'nullable|numeric|min:0',
|
||||
'image' => 'nullable',
|
||||
'source' => 'nullable|string|max:255',
|
||||
'status' => 'nullable|integer|in:0,1', // 1=Active, 0=Inactive
|
||||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user