diff --git a/app/Http/Controllers/Web/FAQ/AskController.php b/app/Http/Controllers/Web/FAQ/AskController.php new file mode 100644 index 0000000..8fb578c --- /dev/null +++ b/app/Http/Controllers/Web/FAQ/AskController.php @@ -0,0 +1,44 @@ +middleware('auth:sanctum'); + } + + protected function run(Request $request): JsonResponse + { + $param = $this->param; + + $this->manager->setCustomer(Customer::getSelf()) + ->register($param->genre, $param->ask); + + return $this->successResponse(); + } +} diff --git a/app/Http/Controllers/Web/FAQ/AskParam.php b/app/Http/Controllers/Web/FAQ/AskParam.php new file mode 100644 index 0000000..d9a5def --- /dev/null +++ b/app/Http/Controllers/Web/FAQ/AskParam.php @@ -0,0 +1,20 @@ + $this->str(), + 'ask' => $this->str(['max:1000']), + ]; + } +} diff --git a/app/Http/Controllers/Web/FAQ/FAQGenresController.php b/app/Http/Controllers/Web/FAQ/FAQGenresController.php new file mode 100644 index 0000000..dc39923 --- /dev/null +++ b/app/Http/Controllers/Web/FAQ/FAQGenresController.php @@ -0,0 +1,38 @@ +middleware('auth:sanctum'); + } + + protected function run(Request $request): JsonResponse + { + $result = FAQ::getDropDownOptions(FAQ::FIELD_GENRE); + + return $this->successResponse($result); + } +} diff --git a/app/Http/Controllers/Web/FAQ/FAQGenresParam.php b/app/Http/Controllers/Web/FAQ/FAQGenresParam.php new file mode 100644 index 0000000..7d09d76 --- /dev/null +++ b/app/Http/Controllers/Web/FAQ/FAQGenresParam.php @@ -0,0 +1,15 @@ +middleware('auth:sanctum'); + } + + protected function run(Request $request): JsonResponse + { + $nowStr = DateUtil::now()->format('Y-m-d'); + $query = FAQ::getQuery() + ->where(FAQ::FIELD_SHOW_START_DATE, $nowStr, KintoneRecordQueryOperator::LE) + ->where(FAQ::FIELD_SHOW_END_DATE, $nowStr, KintoneRecordQueryOperator::GE) + ->orderByDesc(FAQ::FIELD_GENRE); + + $list = FAQ::getAccess()->some($query); + + $result = []; + foreach ($list as $ele) { + $result[] = $ele->toArray(); + } + + return $this->successResponse($result); + } +} diff --git a/app/Http/Controllers/Web/FAQ/FAQsParam.php b/app/Http/Controllers/Web/FAQ/FAQsParam.php new file mode 100644 index 0000000..13207b5 --- /dev/null +++ b/app/Http/Controllers/Web/FAQ/FAQsParam.php @@ -0,0 +1,15 @@ +getStatusCode() === 401) { return $this->unAuthorizedResponse(); } - throw e; + throw $e; } catch (Exception $e) { $this->transaction->rollBack(); logs()->error([ diff --git a/app/Kintone/KintoneAccess.php b/app/Kintone/KintoneAccess.php index 75dc5a1..521bf00 100644 --- a/app/Kintone/KintoneAccess.php +++ b/app/Kintone/KintoneAccess.php @@ -5,7 +5,7 @@ namespace App\Kintone; use App\Exceptions\ConfigException; use App\Kintone\Models\KintoneModel; use Exception; -use Illuminate\Http\Client\Response; +use Illuminate\Http\UploadedFile; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Http; use Log; @@ -18,7 +18,7 @@ class KintoneAccess private string $appName; private string $host; - private string $apiToken; + private string $apiToken = ""; private int $appId; private const DEFAULT_FIELDS = [ @@ -38,6 +38,7 @@ class KintoneAccess private const URL_RECORDS = "/k/v1/records.json"; private const URL_CURSOL = "/k/v1/records/cursor.json"; private const URL_FILE = "/k/v1/file.json"; + private const URL_APP_FORM_FIELDS = "/k/v1/app/form/fields.json"; public function __construct(string $appName) @@ -62,11 +63,23 @@ class KintoneAccess throw new ConfigException($key, $appId); } + $this->addAppToken($appName); $this->host = $host; - $this->apiToken = $apiToken; $this->appId = $appId; } + public function addAppToken(string $appName): static + { + $key = "kintone.applications." . $appName . ".apiToken"; + $apiToken = config($key); + if (!$apiToken) { + throw new ConfigException($key, $apiToken); + } + $this->apiToken = $this->apiToken ? $this->apiToken . "," . $apiToken : $apiToken; + return $this; + } + + public function setFields(array $fields): static { $this->fields = [ @@ -366,12 +379,18 @@ class KintoneAccess return $response; } - public function filePut($file): string + /** + * ファイルアップロード + * + * @param UploadedFile $file + * @return string fileKey + */ + public function filePut(UploadedFile $file): string { $response = Http::withHeaders([ "X-Cybozu-API-Token" => $this->apiToken, "Content-Type" => "multipart/form-data", - ])->post($this->getCursorUrl(), $file); + ])->post($this->getFileUrl(), $file); if ($response->failed()) { $e = $response->toException(); @@ -380,7 +399,27 @@ class KintoneAccess throw $e; } } - return $response['']; + return $response['fileKey']; + } + + public function getAppFormFields(): array + { + $response = Http::withHeaders([ + "X-Cybozu-API-Token" => $this->apiToken, + + ])->get($this->getAppFormFieldsUrl(), [ + "app" => $this->appId, + ]); + + if ($response->failed()) { + $e = $response->toException(); + if ($e instanceof Exception) { + Log::error($e->getMessage()); + throw $e; + } + } + + return $response['properties']; } private function getRecordUrl() @@ -401,6 +440,10 @@ class KintoneAccess { return $this->getUrl(self::URL_FILE); } + private function getAppFormFieldsUrl() + { + return $this->getUrl(self::URL_APP_FORM_FIELDS); + } private function getUrl(string $path) { diff --git a/app/Kintone/Models/Ask.php b/app/Kintone/Models/Ask.php new file mode 100644 index 0000000..48147aa --- /dev/null +++ b/app/Kintone/Models/Ask.php @@ -0,0 +1,28 @@ + FieldType::SINGLE_LINE_TEXT, + self::FIELD_GENRE => FieldType::SINGLE_LINE_TEXT, + self::FIELD_ASK => FieldType::MULTI_LINE_TEXT, + self::FIELD_ASK_DATETIME => FieldType::DATETIME, + ]; + + protected const FIELD_NAMES = [ + ...parent::FIELD_NAMES, + ]; +} diff --git a/app/Kintone/Models/Customer.php b/app/Kintone/Models/Customer.php index d9c635c..f8c0d11 100644 --- a/app/Kintone/Models/Customer.php +++ b/app/Kintone/Models/Customer.php @@ -16,6 +16,7 @@ class Customer extends KintoneModel const FIELD_CUSTOMER_NAME_KANA = "顧客名カナ"; const FIELD_EMAIL = "メールアドレス"; const FIELD_PHONE_NUMBER = "電話番号"; + const FIELD_STUDENT_LICENSE_IMAGES = "学生証画像"; protected const FIELDS = [ ...parent::FIELDS, @@ -24,6 +25,7 @@ class Customer extends KintoneModel self::FIELD_CUSTOMER_NAME_KANA => FieldType::SINGLE_LINE_TEXT, self::FIELD_EMAIL => FieldType::LINK, self::FIELD_PHONE_NUMBER => FieldType::LINK, + self::FIELD_STUDENT_LICENSE_IMAGES => FieldType::FILE, ]; protected const FIELD_NAMES = [ diff --git a/app/Kintone/Models/FAQ.php b/app/Kintone/Models/FAQ.php new file mode 100644 index 0000000..af0ba10 --- /dev/null +++ b/app/Kintone/Models/FAQ.php @@ -0,0 +1,33 @@ + FieldType::DROP_DOWN, + self::FIELD_QUESTION => FieldType::MULTI_LINE_TEXT, + self::FIELD_ANSWER => FieldType::MULTI_LINE_TEXT, + self::FIELD_SHOW_START_DATE => FieldType::DATE, + self::FIELD_SHOW_END_DATE => FieldType::DATE, + ]; + + protected const FIELD_NAMES = [ + ...parent::FIELD_NAMES, + self::FIELD_GENRE => 'genre', + self::FIELD_QUESTION => 'question', + self::FIELD_ANSWER => 'answer', + ]; +} diff --git a/app/Kintone/Models/KintoneModel.php b/app/Kintone/Models/KintoneModel.php index 023c43d..e7a3bc6 100644 --- a/app/Kintone/Models/KintoneModel.php +++ b/app/Kintone/Models/KintoneModel.php @@ -197,6 +197,22 @@ abstract class KintoneModel return $ret; } + public static function getDropDownOptions(string $fieldCode): array + { + $ret = []; + $properties = static::getAccess()->getAppFormFields(); + $options = Arr::get($properties, sprintf("%s.options", $fieldCode)); + $ret = Arr::pluck(Arr::sort($options, function ($option) { + return data_get($option, "index"); + }), "label"); + // foreach ($options as $option) { + // $index = data_get($option, "index"); + // $label = data_get($option, "label"); + // $ret[$index] = $label; + // } + return $ret; + } + /** * 変更前データを現在データで上書きする * diff --git a/app/Logic/AskManager.php b/app/Logic/AskManager.php new file mode 100644 index 0000000..fa37cff --- /dev/null +++ b/app/Logic/AskManager.php @@ -0,0 +1,45 @@ +customer = $customer; + return $this; + } + + + public function register(string $genre, string $ask) + { + if ($this->customer === null) { + throw new LogicException("顧客NULL"); + } + + + $this->model->set(Ask::FIELD_ASK_DATETIME, DateUtil::now()); + $this->model->set(Ask::FIELD_GENRE, $genre); + $this->model->set(Ask::FIELD_ASK, $ask); + $this->model->set(Ask::FIELD_CUSTOMER_CODE, $this->customer->getStr(Customer::FIELD_CUSTOMER_CODE)); + + $this->model->getAccess() + ->addAppToken(Customer::class) + ->create($this->model); + } +} diff --git a/config/kintone.php b/config/kintone.php index 083790a..0e7c83d 100644 --- a/config/kintone.php +++ b/config/kintone.php @@ -31,6 +31,8 @@ return [ ...App\Kintone\Models\SeasonTicketContract::setConfig(), ...App\Kintone\Models\PaymentPlan::setConfig(), ...App\Kintone\Models\GeneralApplication::setConfig(), + ...App\Kintone\Models\FAQ::setConfig(), + ...App\Kintone\Models\Ask::setConfig(), ], ]; diff --git a/lang/en/auth.php b/lang/en/auth.php new file mode 100644 index 0000000..6598e2c --- /dev/null +++ b/lang/en/auth.php @@ -0,0 +1,20 @@ + 'These credentials do not match our records.', + 'password' => 'The provided password is incorrect.', + 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', + +]; diff --git a/lang/en/pagination.php b/lang/en/pagination.php new file mode 100644 index 0000000..d481411 --- /dev/null +++ b/lang/en/pagination.php @@ -0,0 +1,19 @@ + '« Previous', + 'next' => 'Next »', + +]; diff --git a/lang/en/passwords.php b/lang/en/passwords.php new file mode 100644 index 0000000..f1223bd --- /dev/null +++ b/lang/en/passwords.php @@ -0,0 +1,22 @@ + 'Your password has been reset.', + 'sent' => 'We have emailed your password reset link.', + 'throttled' => 'Please wait before retrying.', + 'token' => 'This password reset token is invalid.', + 'user' => "We can't find a user with that email address.", + +]; diff --git a/lang/en/validation.php b/lang/en/validation.php new file mode 100644 index 0000000..99f7c61 --- /dev/null +++ b/lang/en/validation.php @@ -0,0 +1,184 @@ + 'The :attribute field must be accepted.', + 'accepted_if' => 'The :attribute field must be accepted when :other is :value.', + 'active_url' => 'The :attribute field must be a valid URL.', + 'after' => 'The :attribute field must be a date after :date.', + 'after_or_equal' => 'The :attribute field must be a date after or equal to :date.', + 'alpha' => 'The :attribute field must only contain letters.', + 'alpha_dash' => 'The :attribute field must only contain letters, numbers, dashes, and underscores.', + 'alpha_num' => 'The :attribute field must only contain letters and numbers.', + 'array' => 'The :attribute field must be an array.', + 'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.', + 'before' => 'The :attribute field must be a date before :date.', + 'before_or_equal' => 'The :attribute field must be a date before or equal to :date.', + 'between' => [ + 'array' => 'The :attribute field must have between :min and :max items.', + 'file' => 'The :attribute field must be between :min and :max kilobytes.', + 'numeric' => 'The :attribute field must be between :min and :max.', + 'string' => 'The :attribute field must be between :min and :max characters.', + ], + 'boolean' => 'The :attribute field must be true or false.', + 'confirmed' => 'The :attribute field confirmation does not match.', + 'current_password' => 'The password is incorrect.', + 'date' => 'The :attribute field must be a valid date.', + 'date_equals' => 'The :attribute field must be a date equal to :date.', + 'date_format' => 'The :attribute field must match the format :format.', + 'decimal' => 'The :attribute field must have :decimal decimal places.', + 'declined' => 'The :attribute field must be declined.', + 'declined_if' => 'The :attribute field must be declined when :other is :value.', + 'different' => 'The :attribute field and :other must be different.', + 'digits' => 'The :attribute field must be :digits digits.', + 'digits_between' => 'The :attribute field must be between :min and :max digits.', + 'dimensions' => 'The :attribute field has invalid image dimensions.', + 'distinct' => 'The :attribute field has a duplicate value.', + 'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.', + 'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.', + 'email' => 'The :attribute field must be a valid email address.', + 'ends_with' => 'The :attribute field must end with one of the following: :values.', + 'enum' => 'The selected :attribute is invalid.', + 'exists' => 'The selected :attribute is invalid.', + 'file' => 'The :attribute field must be a file.', + 'filled' => 'The :attribute field must have a value.', + 'gt' => [ + 'array' => 'The :attribute field must have more than :value items.', + 'file' => 'The :attribute field must be greater than :value kilobytes.', + 'numeric' => 'The :attribute field must be greater than :value.', + 'string' => 'The :attribute field must be greater than :value characters.', + ], + 'gte' => [ + 'array' => 'The :attribute field must have :value items or more.', + 'file' => 'The :attribute field must be greater than or equal to :value kilobytes.', + 'numeric' => 'The :attribute field must be greater than or equal to :value.', + 'string' => 'The :attribute field must be greater than or equal to :value characters.', + ], + 'image' => 'The :attribute field must be an image.', + 'in' => 'The selected :attribute is invalid.', + 'in_array' => 'The :attribute field must exist in :other.', + 'integer' => 'The :attribute field must be an integer.', + 'ip' => 'The :attribute field must be a valid IP address.', + 'ipv4' => 'The :attribute field must be a valid IPv4 address.', + 'ipv6' => 'The :attribute field must be a valid IPv6 address.', + 'json' => 'The :attribute field must be a valid JSON string.', + 'lowercase' => 'The :attribute field must be lowercase.', + 'lt' => [ + 'array' => 'The :attribute field must have less than :value items.', + 'file' => 'The :attribute field must be less than :value kilobytes.', + 'numeric' => 'The :attribute field must be less than :value.', + 'string' => 'The :attribute field must be less than :value characters.', + ], + 'lte' => [ + 'array' => 'The :attribute field must not have more than :value items.', + 'file' => 'The :attribute field must be less than or equal to :value kilobytes.', + 'numeric' => 'The :attribute field must be less than or equal to :value.', + 'string' => 'The :attribute field must be less than or equal to :value characters.', + ], + 'mac_address' => 'The :attribute field must be a valid MAC address.', + 'max' => [ + 'array' => 'The :attribute field must not have more than :max items.', + 'file' => 'The :attribute field must not be greater than :max kilobytes.', + 'numeric' => 'The :attribute field must not be greater than :max.', + 'string' => 'The :attribute field must not be greater than :max characters.', + ], + 'max_digits' => 'The :attribute field must not have more than :max digits.', + 'mimes' => 'The :attribute field must be a file of type: :values.', + 'mimetypes' => 'The :attribute field must be a file of type: :values.', + 'min' => [ + 'array' => 'The :attribute field must have at least :min items.', + 'file' => 'The :attribute field must be at least :min kilobytes.', + 'numeric' => 'The :attribute field must be at least :min.', + 'string' => 'The :attribute field must be at least :min characters.', + ], + 'min_digits' => 'The :attribute field must have at least :min digits.', + 'missing' => 'The :attribute field must be missing.', + 'missing_if' => 'The :attribute field must be missing when :other is :value.', + 'missing_unless' => 'The :attribute field must be missing unless :other is :value.', + 'missing_with' => 'The :attribute field must be missing when :values is present.', + 'missing_with_all' => 'The :attribute field must be missing when :values are present.', + 'multiple_of' => 'The :attribute field must be a multiple of :value.', + 'not_in' => 'The selected :attribute is invalid.', + 'not_regex' => 'The :attribute field format is invalid.', + 'numeric' => 'The :attribute field must be a number.', + 'password' => [ + 'letters' => 'The :attribute field must contain at least one letter.', + 'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.', + 'numbers' => 'The :attribute field must contain at least one number.', + 'symbols' => 'The :attribute field must contain at least one symbol.', + 'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.', + ], + 'present' => 'The :attribute field must be present.', + 'prohibited' => 'The :attribute field is prohibited.', + 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', + 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', + 'prohibits' => 'The :attribute field prohibits :other from being present.', + 'regex' => 'The :attribute field format is invalid.', + 'required' => 'The :attribute field is required.', + 'required_array_keys' => 'The :attribute field must contain entries for: :values.', + 'required_if' => 'The :attribute field is required when :other is :value.', + 'required_if_accepted' => 'The :attribute field is required when :other is accepted.', + 'required_unless' => 'The :attribute field is required unless :other is in :values.', + 'required_with' => 'The :attribute field is required when :values is present.', + 'required_with_all' => 'The :attribute field is required when :values are present.', + 'required_without' => 'The :attribute field is required when :values is not present.', + 'required_without_all' => 'The :attribute field is required when none of :values are present.', + 'same' => 'The :attribute field must match :other.', + 'size' => [ + 'array' => 'The :attribute field must contain :size items.', + 'file' => 'The :attribute field must be :size kilobytes.', + 'numeric' => 'The :attribute field must be :size.', + 'string' => 'The :attribute field must be :size characters.', + ], + 'starts_with' => 'The :attribute field must start with one of the following: :values.', + 'string' => 'The :attribute field must be a string.', + 'timezone' => 'The :attribute field must be a valid timezone.', + 'unique' => 'The :attribute has already been taken.', + 'uploaded' => 'The :attribute failed to upload.', + 'uppercase' => 'The :attribute field must be uppercase.', + 'url' => 'The :attribute field must be a valid URL.', + 'ulid' => 'The :attribute field must be a valid ULID.', + 'uuid' => 'The :attribute field must be a valid UUID.', + + /* + |-------------------------------------------------------------------------- + | Custom Validation Language Lines + |-------------------------------------------------------------------------- + | + | Here you may specify custom validation messages for attributes using the + | convention "attribute.rule" to name the lines. This makes it quick to + | specify a specific custom language line for a given attribute rule. + | + */ + + 'custom' => [ + 'attribute-name' => [ + 'rule-name' => 'custom-message', + ], + ], + + /* + |-------------------------------------------------------------------------- + | Custom Validation Attributes + |-------------------------------------------------------------------------- + | + | The following language lines are used to swap our attribute placeholder + | with something more reader friendly such as "E-Mail Address" instead + | of "email". This simply helps us make our message more expressive. + | + */ + + 'attributes' => [], + +]; diff --git a/lang/ja/auth.php b/lang/ja/auth.php new file mode 100644 index 0000000..6598e2c --- /dev/null +++ b/lang/ja/auth.php @@ -0,0 +1,20 @@ + 'These credentials do not match our records.', + 'password' => 'The provided password is incorrect.', + 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', + +]; diff --git a/lang/ja/pagination.php b/lang/ja/pagination.php new file mode 100644 index 0000000..d481411 --- /dev/null +++ b/lang/ja/pagination.php @@ -0,0 +1,19 @@ + '« Previous', + 'next' => 'Next »', + +]; diff --git a/lang/ja/passwords.php b/lang/ja/passwords.php new file mode 100644 index 0000000..f1223bd --- /dev/null +++ b/lang/ja/passwords.php @@ -0,0 +1,22 @@ + 'Your password has been reset.', + 'sent' => 'We have emailed your password reset link.', + 'throttled' => 'Please wait before retrying.', + 'token' => 'This password reset token is invalid.', + 'user' => "We can't find a user with that email address.", + +]; diff --git a/lang/ja/validation.php b/lang/ja/validation.php new file mode 100644 index 0000000..9ba9f01 --- /dev/null +++ b/lang/ja/validation.php @@ -0,0 +1,205 @@ + 'The :attribute field must be accepted.', + 'accepted_if' => 'The :attribute field must be accepted when :other is :value.', + 'active_url' => 'The :attribute field must be a valid URL.', + 'after' => 'The :attribute field must be a date after :date.', + 'after_or_equal' => 'The :attribute field must be a date after or equal to :date.', + 'alpha' => 'The :attribute field must only contain letters.', + 'alpha_dash' => 'The :attribute field must only contain letters, numbers, dashes, and underscores.', + 'alpha_num' => 'The :attribute field must only contain letters and numbers.', + 'array' => 'The :attribute field must be an array.', + 'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.', + 'before' => 'The :attribute field must be a date before :date.', + 'before_or_equal' => 'The :attribute field must be a date before or equal to :date.', + 'between' => [ + 'array' => 'The :attribute field must have between :min and :max items.', + 'file' => 'The :attribute field must be between :min and :max kilobytes.', + 'numeric' => 'The :attribute field must be between :min and :max.', + 'string' => 'The :attribute field must be between :min and :max characters.', + ], + 'boolean' => 'The :attribute field must be true or false.', + 'confirmed' => 'The :attribute field confirmation does not match.', + 'current_password' => 'The password is incorrect.', + 'date' => 'The :attribute field must be a valid date.', + 'date_equals' => 'The :attribute field must be a date equal to :date.', + 'date_format' => 'The :attribute field must match the format :format.', + 'decimal' => 'The :attribute field must have :decimal decimal places.', + 'declined' => 'The :attribute field must be declined.', + 'declined_if' => 'The :attribute field must be declined when :other is :value.', + 'different' => 'The :attribute field and :other must be different.', + 'digits' => 'The :attribute field must be :digits digits.', + 'digits_between' => 'The :attribute field must be between :min and :max digits.', + 'dimensions' => 'The :attribute field has invalid image dimensions.', + 'distinct' => 'The :attribute field has a duplicate value.', + 'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.', + 'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.', + 'email' => 'The :attribute field must be a valid email address.', + 'ends_with' => 'The :attribute field must end with one of the following: :values.', + 'enum' => 'The selected :attribute is invalid.', + 'exists' => 'The selected :attribute is invalid.', + 'file' => 'The :attribute field must be a file.', + 'filled' => 'The :attribute field must have a value.', + 'gt' => [ + 'array' => 'The :attribute field must have more than :value items.', + 'file' => 'The :attribute field must be greater than :value kilobytes.', + 'numeric' => 'The :attribute field must be greater than :value.', + 'string' => 'The :attribute field must be greater than :value characters.', + ], + 'gte' => [ + 'array' => 'The :attribute field must have :value items or more.', + 'file' => 'The :attribute field must be greater than or equal to :value kilobytes.', + 'numeric' => 'The :attribute field must be greater than or equal to :value.', + 'string' => 'The :attribute field must be greater than or equal to :value characters.', + ], + 'image' => 'The :attribute field must be an image.', + 'in' => 'The selected :attribute is invalid.', + 'in_array' => 'The :attribute field must exist in :other.', + 'integer' => 'The :attribute field must be an integer.', + 'ip' => 'The :attribute field must be a valid IP address.', + 'ipv4' => 'The :attribute field must be a valid IPv4 address.', + 'ipv6' => 'The :attribute field must be a valid IPv6 address.', + 'json' => 'The :attribute field must be a valid JSON string.', + 'lowercase' => 'The :attribute field must be lowercase.', + 'lt' => [ + 'array' => 'The :attribute field must have less than :value items.', + 'file' => 'The :attribute field must be less than :value kilobytes.', + 'numeric' => 'The :attribute field must be less than :value.', + 'string' => 'The :attribute field must be less than :value characters.', + ], + 'lte' => [ + 'array' => 'The :attribute field must not have more than :value items.', + 'file' => 'The :attribute field must be less than or equal to :value kilobytes.', + 'numeric' => 'The :attribute field must be less than or equal to :value.', + 'string' => 'The :attribute field must be less than or equal to :value characters.', + ], + 'mac_address' => 'The :attribute field must be a valid MAC address.', + 'max' => [ + 'array' => 'The :attribute field must not have more than :max items.', + 'file' => 'The :attribute field must not be greater than :max kilobytes.', + 'numeric' => 'The :attribute field must not be greater than :max.', + 'string' => 'The :attribute field must not be greater than :max characters.', + ], + 'max_digits' => 'The :attribute field must not have more than :max digits.', + 'mimes' => 'The :attribute field must be a file of type: :values.', + 'mimetypes' => 'The :attribute field must be a file of type: :values.', + 'min' => [ + 'array' => 'The :attribute field must have at least :min items.', + 'file' => 'The :attribute field must be at least :min kilobytes.', + 'numeric' => 'The :attribute field must be at least :min.', + 'string' => 'The :attribute field must be at least :min characters.', + ], + 'min_digits' => 'The :attribute field must have at least :min digits.', + 'missing' => 'The :attribute field must be missing.', + 'missing_if' => 'The :attribute field must be missing when :other is :value.', + 'missing_unless' => 'The :attribute field must be missing unless :other is :value.', + 'missing_with' => 'The :attribute field must be missing when :values is present.', + 'missing_with_all' => 'The :attribute field must be missing when :values are present.', + 'multiple_of' => 'The :attribute field must be a multiple of :value.', + 'not_in' => 'The selected :attribute is invalid.', + 'not_regex' => 'The :attribute field format is invalid.', + 'numeric' => 'The :attribute field must be a number.', + 'password' => [ + 'letters' => 'The :attribute field must contain at least one letter.', + 'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.', + 'numbers' => 'The :attribute field must contain at least one number.', + 'symbols' => 'The :attribute field must contain at least one symbol.', + 'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.', + ], + 'present' => 'The :attribute field must be present.', + 'prohibited' => 'The :attribute field is prohibited.', + 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', + 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', + 'prohibits' => 'The :attribute field prohibits :other from being present.', + 'regex' => 'The :attribute field format is invalid.', + 'required' => 'The :attribute field is required.', + 'required_array_keys' => 'The :attribute field must contain entries for: :values.', + 'required_if' => 'The :attribute field is required when :other is :value.', + 'required_if_accepted' => 'The :attribute field is required when :other is accepted.', + 'required_unless' => 'The :attribute field is required unless :other is in :values.', + 'required_with' => 'The :attribute field is required when :values is present.', + 'required_with_all' => 'The :attribute field is required when :values are present.', + 'required_without' => 'The :attribute field is required when :values is not present.', + 'required_without_all' => 'The :attribute field is required when none of :values are present.', + 'same' => 'The :attribute field must match :other.', + 'size' => [ + 'array' => 'The :attribute field must contain :size items.', + 'file' => 'The :attribute field must be :size kilobytes.', + 'numeric' => 'The :attribute field must be :size.', + 'string' => 'The :attribute field must be :size characters.', + ], + 'starts_with' => 'The :attribute field must start with one of the following: :values.', + 'string' => 'The :attribute field must be a string.', + 'timezone' => 'The :attribute field must be a valid timezone.', + 'unique' => 'The :attribute has already been taken.', + 'uploaded' => 'The :attribute failed to upload.', + 'uppercase' => 'The :attribute field must be uppercase.', + 'url' => 'The :attribute field must be a valid URL.', + 'ulid' => 'The :attribute field must be a valid ULID.', + 'uuid' => 'The :attribute field must be a valid UUID.', + + /* + |-------------------------------------------------------------------------- + | Custom Validation Language Lines + |-------------------------------------------------------------------------- + | + | Here you may specify custom validation messages for attributes using the + | convention "attribute.rule" to name the lines. This makes it quick to + | specify a specific custom language line for a given attribute rule. + | + */ + + 'custom' => [ + 'attribute-name' => [ + 'rule-name' => 'custom-message', + ], + ], + + /* + |-------------------------------------------------------------------------- + | Custom Validation Attributes + |-------------------------------------------------------------------------- + | + | The following language lines are used to swap our attribute placeholder + | with something more reader friendly such as "E-Mail Address" instead + | of "email". This simply helps us make our message more expressive. + | + */ + + 'attributes' => [], + +], [ + 'after' => '日付の前後関係が正しくありません', + 'after_or_equal' => '日付の前後関係が正しくありません', + 'before_or_equal' => '日付の前後関係が正しくありません', + 'between' => [ + 'string' => ':min から :max 文字入力してください', + ], + 'date' => '日付を入力してください', + 'email' => 'Emailの形式が正しくありません', + 'enum' => '正しい項目を選択してください', + 'exists' => '存在しません', + 'max' => [ + 'string' => ':max 文字まで入力できます', + ], + 'numeric' => '数値を入力してください', + 'required' => '必須項目です', + 'size' => [ + 'string' => ':size 桁で入力してください.', + ], + 'string' => '文字を入力してください', + 'unique' => 'すでに使われています', +]); diff --git a/routes/api.php b/routes/api.php index 5062b53..1984459 100644 --- a/routes/api.php +++ b/routes/api.php @@ -24,3 +24,8 @@ RouteHelper::post('/season-ticket-contract/sticker-re-order', App\Http\Controlle RouteHelper::post('/season-ticket-contract/parking-certificate-order', App\Http\Controllers\Web\SeasonTicketContract\ParkingCertificateOrderController::class); RouteHelper::post('/season-ticket-contract/termination-order', App\Http\Controllers\Web\SeasonTicketContract\TerminationOrderController::class); RouteHelper::post('/season-ticket-contract/update-vehicle-info-order', App\Http\Controllers\Web\SeasonTicketContract\UpdateVehicleInfoOrderController::class); + +RouteHelper::get('/faq', App\Http\Controllers\Web\FAQ\FAQsController::class); +RouteHelper::get('/faq/genres', App\Http\Controllers\Web\FAQ\FAQGenresController::class); +RouteHelper::post('/ask', App\Http\Controllers\Web\FAQ\AskController::class); +RouteHelper::post('/upload/student-license-images', App\Http\Controllers\Web\Customer\UploadStudentLicenseImagesController::class); diff --git a/tests/Feature/KintoneAccessTest.php b/tests/Feature/KintoneAccessTest.php index 5aabec1..fc71cf1 100644 --- a/tests/Feature/KintoneAccessTest.php +++ b/tests/Feature/KintoneAccessTest.php @@ -3,6 +3,7 @@ namespace Tests\Feature; use App\Kintone\Models\Customer; +use App\Kintone\Models\FAQ; use App\Kintone\Models\SeasonTicketContract; use Illuminate\Support\Carbon; use Tests\TestCase; @@ -55,4 +56,12 @@ class KintoneAccessTest extends TestCase $this->assertEquals("2023/05/01", $array['contract_start_date']); $this->assertEquals("2121/12/31", $array['contract_end_date']); } + + public function test_app_form_field(): void + { + + $options = FAQ::getDropDownOptions(FAQ::FIELD_GENRE); + + $this->assertTrue(true); + } }