How to store multiple images paths in database?

Posted 7 months ago by AlexanderKim

I have input with multiple attribute, that allows multiple image uploads. However if it'll be a single image input, then i have no problems to store it's path in a database, but how to store multiple paths in a single column, something like how to insert an array in to a database?

I save images this way:

        if ($request->file('images')) {
            $images = $request->file('images');

            $filenames = Str::lower(
                pathinfo($image->getClientOriginalName(), PATHINFO_FILENAME) . '-' . uniqid() . '.' . $image->getClientOriginalExtension()
                );
            $destination = 'uploads/';
            $images->move($destination, $filenames);

            $product->image = $filenames;
        }

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.