商品列表、分类管理、客户等级
This commit is contained in:
@@ -2,7 +2,11 @@
|
||||
|
||||
namespace App\Http\Requests\Product;
|
||||
|
||||
use App\Models\ProductCategoryModel;
|
||||
use App\Models\SupplierModel;
|
||||
use Illuminate\Validation\Rules\Exists;
|
||||
use Modules\Common\Http\Requests\BaseFormRequest;
|
||||
use Modules\SystemTool\Models\SysFileModel;
|
||||
|
||||
/**
|
||||
* 商品档案 创建/编辑 验证(含多等级价格 prices 数组)
|
||||
@@ -14,14 +18,17 @@ class ProductFormRequest extends BaseFormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'category_id' => ['required','integer', new Exists(ProductCategoryModel::class,'id')],
|
||||
'supplier_id' => ['nullable','integer', 'exclude_if:supplier_id,0', new Exists(SupplierModel::class,'id')],
|
||||
'name' => 'required|string|max:100',
|
||||
'spec' => 'nullable|string|max:100',
|
||||
'grade' => 'nullable|string|max:50',
|
||||
'unit' => 'nullable|string|max:20',
|
||||
'category_id' => 'required|integer|exists:product_category,id',
|
||||
'supplier_id' => 'nullable|integer|exclude_if:supplier_id,0|exists:supplier,id',
|
||||
'image' => 'nullable|string|max:255',
|
||||
'image_ids' => 'nullable|array|max:255',
|
||||
'image_ids.*' => ['integer', new Exists(SysFileModel::class, 'id')],
|
||||
'content' => 'nullable|string',
|
||||
'sort' => 'nullable|integer',
|
||||
'shelf_life' => 'nullable|integer|min:0',
|
||||
'stock' => 'nullable|integer|min:0',
|
||||
'status' => 'nullable|integer|in:0,1',
|
||||
'remark' => 'nullable|string|max:255',
|
||||
'prices' => 'nullable|array',
|
||||
|
||||
Reference in New Issue
Block a user