42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?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'],
|
|
];
|
|
}
|