[{% for field in insert_fields %}"{{ field.column_name }}"{% if not loop.last %}, {% endif %}{% endfor %}], 'edit' => [{% for field in edit_fields %}"{{ field.column_name }}"{% if not loop.last %}, {% endif %}{% endfor %}], ]; /** * 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 [ {% for field in fields %} '{{ field.column_name }}' => 'required', {% endfor %} ]; } public function messages(): array { return [ {% for field in edit_fields %} '{{ field.column_name }}.required' => '{{ field.column_comment }}必传!', {% endfor %} ]; } }