タグ未入力時に空白のタグが生成されるバグの修正
This commit is contained in:
parent
917675f9bd
commit
336d368369
@ -48,12 +48,14 @@ class EjaculationController extends Controller
|
||||
'is_private' => $request->has('is_private') ?? false
|
||||
]);
|
||||
|
||||
$tags = explode(' ', $inputs['tags']);
|
||||
$tagIds = [];
|
||||
if (!empty($inputs['tags'])) {
|
||||
$tags = explode(' ', $inputs['tags']);
|
||||
foreach ($tags as $tag) {
|
||||
$tag = Tag::firstOrCreate(['name' => $tag]);
|
||||
$tagIds[] = $tag->id;
|
||||
}
|
||||
}
|
||||
$ejaculation->tags()->sync($tagIds);
|
||||
|
||||
return redirect()->route('checkin.show', ['id' => $ejaculation->id])->with('status', 'チェックインしました!');
|
||||
@ -119,12 +121,14 @@ class EjaculationController extends Controller
|
||||
'is_private' => $request->has('is_private') ?? false
|
||||
])->save();
|
||||
|
||||
$tags = explode(' ', $inputs['tags']);
|
||||
$tagIds = [];
|
||||
if (!empty($inputs['tags'])) {
|
||||
$tags = explode(' ', $inputs['tags']);
|
||||
foreach ($tags as $tag) {
|
||||
$tag = Tag::firstOrCreate(['name' => $tag]);
|
||||
$tagIds[] = $tag->id;
|
||||
}
|
||||
}
|
||||
$ejaculation->tags()->sync($tagIds);
|
||||
|
||||
return redirect()->route('checkin.show', ['id' => $ejaculation->id])->with('status', 'チェックインを修正しました!');
|
||||
|
Loading…
Reference in New Issue
Block a user