migrate to gtea from bistbucket
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Http\Requests\Unit;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UnitStoreRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string|max:255',
|
||||
'short_name' => 'required|string|max:50',
|
||||
'type' => 'required|in:weight,volume,count,length',
|
||||
'base_unit_id' => 'nullable|integer|exists:units,id',
|
||||
'operator' => 'nullable|in:*,/',
|
||||
'operator_value' => 'nullable|numeric|min:0',
|
||||
'priority' => 'nullable|integer|min:0',
|
||||
'version' => 'nullable|integer|min:1',
|
||||
'is_default' => 'nullable|boolean',
|
||||
'status' => 'nullable|in:0,1',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'name.required' => 'Unit name is required.',
|
||||
'short_name.required' => 'Unit short name is required.',
|
||||
'type.required' => 'Unit type is required.',
|
||||
'type.in' => 'Unit type must be one of weight, volume, count, or length.',
|
||||
'base_unit_id.exists' => 'Selected base unit does not exist.',
|
||||
'operator.in' => 'Operator must be * or /.',
|
||||
'operator_value.numeric' => 'Operator value must be a number.',
|
||||
'status.in' => 'Status must be 0 (inactive) or 1 (active).',
|
||||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Http\Requests\Unit;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UnitUpdateRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string|max:255',
|
||||
'short_name' => 'required|string|max:50',
|
||||
'type' => 'required|in:weight,volume,count,length',
|
||||
'base_unit_id' => 'nullable|integer|exists:units,id',
|
||||
'operator' => 'nullable|in:*,/',
|
||||
'operator_value' => 'nullable|numeric|min:0',
|
||||
'priority' => 'nullable|integer|min:0',
|
||||
'version' => 'nullable|integer|min:1',
|
||||
'is_default' => 'nullable|boolean',
|
||||
'status' => 'nullable|in:0,1',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'name.required' => 'Unit name is required.',
|
||||
'short_name.required' => 'Unit short name is required.',
|
||||
'type.required' => 'Unit type is required.',
|
||||
'type.in' => 'Unit type must be one of weight, volume, count, or length.',
|
||||
'base_unit_id.exists' => 'Selected base unit does not exist.',
|
||||
'operator.in' => 'Operator must be * or /.',
|
||||
'operator_value.numeric' => 'Operator value must be a number.',
|
||||
'status.in' => 'Status must be 0 (inactive) or 1 (active).',
|
||||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user