From 915b575e6eb7157cc97c5d1a641bc266d1e681fd Mon Sep 17 00:00:00 2001 From: shibafu Date: Wed, 19 Aug 2020 21:25:07 +0900 Subject: [PATCH] =?UTF-8?q?=E9=9D=9E=E5=85=AC=E9=96=8B=E3=83=95=E3=83=A9?= =?UTF-8?q?=E3=82=B0=E3=80=81=E3=82=BB=E3=83=B3=E3=82=B7=E3=83=86=E3=82=A3?= =?UTF-8?q?=E3=83=96=E3=83=95=E3=83=A9=E3=82=B0=E3=81=AECSV=E5=85=A5?= =?UTF-8?q?=E5=8A=9B=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Rules/FuzzyBoolean.php | 62 +++++++++++++++++++++++++++++ app/Services/CheckinCsvImporter.php | 9 +++++ 2 files changed, 71 insertions(+) create mode 100644 app/Rules/FuzzyBoolean.php diff --git a/app/Rules/FuzzyBoolean.php b/app/Rules/FuzzyBoolean.php new file mode 100644 index 0000000..ec40d71 --- /dev/null +++ b/app/Rules/FuzzyBoolean.php @@ -0,0 +1,62 @@ + ['required', new CsvDateTime()], 'ノート' => 'nullable|string|max:500', 'オカズリンク' => 'nullable|url|max:2000', + '非公開' => ['nullable', new FuzzyBoolean()], + 'センシティブ' => ['nullable', new FuzzyBoolean()], ]); if ($validator->fails()) { @@ -88,6 +91,12 @@ class CheckinCsvImporter $ejaculation->note = str_replace(["\r\n", "\r"], "\n", $record['ノート'] ?? ''); $ejaculation->link = $record['オカズリンク'] ?? ''; $ejaculation->source = Ejaculation::SOURCE_CSV; + if (isset($record['非公開'])) { + $ejaculation->is_private = FuzzyBoolean::isTruthy($record['非公開']); + } + if (isset($record['センシティブ'])) { + $ejaculation->is_too_sensitive = FuzzyBoolean::isTruthy($record['センシティブ']); + } try { $tags = $this->parseTags($line, $record);