40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
final class CityRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
|
|
return [
|
|
'city_name' => ['required', 'string', 'max:20', 'regex:/^[^ -~。-゚]+$/u'],
|
|
'print_layout' => ['required', 'string', 'max:255', 'regex:/^[A-Za-z0-9]+$/'],
|
|
'city_remarks' => ['nullable', 'string', 'max:255'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'city_name.required' => '市区名は必須です。',
|
|
'city_name.regex' => '市区名は全角文字で入力してください。',
|
|
'city_name.max' => '市区名は20文字以内で入力してください。',
|
|
|
|
'print_layout.required' => '印字レイアウトファイルは必須です。',
|
|
'print_layout.regex' => '印字レイアウトファイルは半角英数字で入力してください。',
|
|
'print_layout.max' => '印字レイアウトファイルは255文字以内で入力してください。',
|
|
|
|
'city_remarks.max' => '備考は255文字以内で入力してください。',
|
|
];
|
|
}
|
|
}
|