You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
869 B

1 month ago
<?php
namespace App\Http\Requests\Admin;
use App\Models\FormSchemaDefinition;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreFormSchemaDefinitionRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
/**
* @return array<string, mixed>
*/
public function rules(): array
{
return [
'purpose' => ['required', 'string', Rule::in([
FormSchemaDefinition::PURPOSE_SIGNUP,
FormSchemaDefinition::PURPOSE_REVIEW,
])],
'name' => ['required', 'string', 'max:128'],
/** 允许空数组新建「空版本」required 会把 [] 判为空而拒绝 */
'schema_json' => ['present', 'array'],
'is_published' => ['sometimes', 'boolean'],
];
}
}