電話番号の確認
このコミットが含まれているのは:
コミット
d898bedfe5
|
@ -29,9 +29,20 @@ class ChildrenController extends Controller {
|
|||
}
|
||||
|
||||
public function registerTemporary (Request $r) {
|
||||
// 電話番号の文字数。
|
||||
Validator::extend('tel_size', function ($attribute, $value, $params, $validator) {
|
||||
try {
|
||||
return strlen((string)$value) == 10 || strlen((string)$value) == 11;
|
||||
} catch (\Throwable $e) {
|
||||
Log::critical($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$validate = Validator::make($r->all(), [
|
||||
'tel' => 'required|unique:children|numeric|digits_between:0,99999999999|starts_with:0'
|
||||
'tel' => 'required|unique:children|numeric|starts_with:0|tel_size'
|
||||
]);
|
||||
|
||||
if ($validate->fails()) {
|
||||
// バリデーションエラー
|
||||
return ['status_code' => 422, 'error_messages' => $validate->errors()];
|
||||
|
@ -155,8 +166,18 @@ KIKI承知システムを使って「聞いてない!」「言ってない!
|
|||
}
|
||||
|
||||
public function requestPassword (Request $r) {
|
||||
// 電話番号の文字数。
|
||||
Validator::extend('tel_size', function ($attribute, $value, $params, $validator) {
|
||||
try {
|
||||
return strlen((string)$value) == 10 || strlen((string)$value) == 11;
|
||||
} catch (\Throwable $e) {
|
||||
Log::critical($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$validate = Validator::make($r->all(), [
|
||||
'tel' => 'required|numeric|digits_between:0,99999999999|starts_with:0',
|
||||
'tel' => 'required|numeric|starts_with:0|tel_size'
|
||||
]);
|
||||
|
||||
if ($validate->fails()) {
|
||||
|
@ -395,10 +416,20 @@ https://kikikan.jp/c-account/forgot-password/reset/'.$token;
|
|||
return ['status_code' => 400, 'error_messages' => ['子の更新に失敗しました。']];
|
||||
}
|
||||
|
||||
// 電話番号の文字数。
|
||||
Validator::extend('tel_size', function ($attribute, $value, $params, $validator) {
|
||||
try {
|
||||
return strlen((string)$value) == 10 || strlen((string)$value) == 11;
|
||||
} catch (\Throwable $e) {
|
||||
Log::critical($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// バリデーションエラー
|
||||
$validate = Validator::make($r->all(), [
|
||||
'email' => 'required|max:255|email',
|
||||
'tel' => 'required|numeric|digits_between:0,99999999999|starts_with:0',
|
||||
'tel' => 'required|numeric|starts_with:0|tel_size',
|
||||
'last_name' => 'required|max:100',
|
||||
'first_name' => 'required|max:100',
|
||||
'identity' => 'required|max:20|alpha_num',
|
||||
|
|
|
@ -113,14 +113,25 @@ class FathersController extends Controller {
|
|||
}
|
||||
|
||||
public function registerMain (Request $r) {
|
||||
// 電話番号の文字数。
|
||||
Validator::extend('tel_size', function ($attribute, $value, $params, $validator) {
|
||||
try {
|
||||
return strlen((string)$value) == 10 || strlen((string)$value) == 11;
|
||||
} catch (\Throwable $e) {
|
||||
Log::critical($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$validate = Validator::make($r->all(), [
|
||||
'token' => 'required',
|
||||
'password' => 'required|min:8|max:72|confirmed',
|
||||
'company' => 'max:100',
|
||||
'image' => 'max:1024|mimes:jpg,png,gif',
|
||||
'profile' => 'max:1000',
|
||||
'tel' => 'required|unique:children|numeric|digits_between:0,99999999999|starts_with:0',
|
||||
'tel' => 'required|unique:fathers|numeric|starts_with:0|tel_size',
|
||||
]);
|
||||
|
||||
if ($validate->fails()) {
|
||||
// バリデーションエラー
|
||||
return ['status_code' => 422, 'error_messages' => $validate->errors()];
|
||||
|
@ -310,12 +321,22 @@ class FathersController extends Controller {
|
|||
return ['status_code' => 400, 'error_messages' => ['親の更新に失敗しました。']];
|
||||
}
|
||||
|
||||
// 電話番号の文字数。
|
||||
Validator::extend('tel_size', function ($attribute, $value, $params, $validator) {
|
||||
try {
|
||||
return strlen((string)$value) == 10 || strlen((string)$value) == 11;
|
||||
} catch (\Throwable $e) {
|
||||
Log::critical($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// バリデーションエラー
|
||||
$validate = Validator::make($r->all(), [
|
||||
'email' => 'required|max:255|email',
|
||||
'company' => 'max:100',
|
||||
'profile' => 'max:1000',
|
||||
'tel' => 'required|numeric|digits_between:0,99999999999|starts_with:0',
|
||||
'tel' => 'required|numeric|starts_with:0|tel_size'
|
||||
]);
|
||||
|
||||
if ($validate->fails()) {
|
||||
|
|
|
@ -24,9 +24,9 @@ return [
|
|||
'before' => 'The :attribute must be a date before :date.',
|
||||
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
|
||||
'between' => [
|
||||
'numeric' => 'The :attribute must be between :min and :max.',
|
||||
'numeric' => ' :attribute は :min ・ :max 文字です。',
|
||||
'file' => 'The :attribute must be between :min and :max kilobytes.',
|
||||
'string' => 'The :attribute must be between :min and :max characters.',
|
||||
'string' => ' :attribute は :min ・ :max 文字です。',
|
||||
'array' => 'The :attribute must have between :min and :max items.',
|
||||
],
|
||||
'boolean' => 'The :attribute field must be true or false.',
|
||||
|
@ -119,6 +119,7 @@ return [
|
|||
],
|
||||
'starts_with' => 'The :attribute must start with one of the following: :values.',
|
||||
'string' => 'The :attribute must be a string.',
|
||||
'tel_size' => '電話番号は10・11文字です。',
|
||||
'timezone' => 'The :attribute must be a valid zone.',
|
||||
'unique' => '同じ :attribute は使用できません。',
|
||||
'uploaded' => 'The :attribute failed to upload.',
|
||||
|
|
新しいイシューから参照