Merge pull request #296 from shikorism/fix/295-drop-empty-value-tag

空文字列のタグは保存せず捨てる
This commit is contained in:
shibafu 2019-11-13 00:39:26 +09:00 committed by GitHub
commit a71aa0c3b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,6 +65,10 @@ class EjaculationController extends Controller
if (!empty($inputs['tags'])) {
$tags = explode(' ', $inputs['tags']);
foreach ($tags as $tag) {
if ($tag === '') {
continue;
}
$tag = Tag::firstOrCreate(['name' => $tag]);
$tagIds[] = $tag->id;
}
@ -151,6 +155,10 @@ class EjaculationController extends Controller
if (!empty($inputs['tags'])) {
$tags = explode(' ', $inputs['tags']);
foreach ($tags as $tag) {
if ($tag === '') {
continue;
}
$tag = Tag::firstOrCreate(['name' => $tag]);
$tagIds[] = $tag->id;
}