feat:material material_category
This commit is contained in:
41
app/Request/Admin/MaterialCategoryRequest.php
Normal file
41
app/Request/Admin/MaterialCategoryRequest.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request\Admin;
|
||||
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class MaterialCategoryRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'query_id' =>'required|integer|exists:material_category,id',
|
||||
'id' =>'required|integer',
|
||||
'name' =>'required|string',
|
||||
'parent_id' =>'sometimes|integer|exists:material_category,id',
|
||||
'city_id' =>'required|integer|exists:system_city,id',
|
||||
'kitchen_id' =>'required|integer|exists:kitchen,id',
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
protected array $scenes = [
|
||||
'material_category_info' => ['query_id'],
|
||||
'add' => ['name', 'parent_id', 'city_id', 'kitchen_id'],
|
||||
'edit' => ['id','name', 'parent_id', 'city_id', 'kitchen_id'],
|
||||
'delete' => ['id'],
|
||||
];
|
||||
}
|
||||
44
app/Request/Admin/MaterialRequest.php
Normal file
44
app/Request/Admin/MaterialRequest.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request\Admin;
|
||||
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class MaterialRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'limit' => 'required|integer',
|
||||
'query_name' =>'sometimes|string',
|
||||
'id' =>'required|integer',
|
||||
'category_id' =>'required|integer|exists:material_category,id',
|
||||
'name' =>'required|string',
|
||||
'standard' =>'string',
|
||||
'unit' =>'required|string',
|
||||
'bar_code' =>'string',
|
||||
'city_id' =>'required|integer|exists:system_city,id',
|
||||
'kitchen_id' =>'required|integer|exists:kitchen,id',
|
||||
];
|
||||
}
|
||||
|
||||
protected array $scenes = [
|
||||
'list' => ['limit','query_name'],
|
||||
'add' => ['category_id', 'name', 'standard', 'unit', 'bar_code', 'city_id', 'kitchen_id'],
|
||||
'edit' => ['id','category_id', 'name', 'standard', 'unit', 'bar_code','status'],
|
||||
'delete' => ['id'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user