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.

34 lines
925 B

5 months 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,
1 month ago
FormSchemaDefinition::PURPOSE_AUDIENCE,
5 months ago
])],
'name' => ['required', 'string', 'max:128'],
/** 允许空数组(新建「空版本」);required 会把 [] 判为空而拒绝 */
'schema_json' => ['present', 'array'],
'is_published' => ['sometimes', 'boolean'],
];
}
}