How to store multiple Array values in one column in PHP

In this tutorial, I’m going to learn how to store multiple data in one field. so follow this tutorial in this tutorial we have mentioned it in a very easy way.

Step 1: In Blade Page get data in a foreach().

@foreach($user_slug_summary as $index => $item)
                    <input type="hidden" value="{{ $item->slug }}" name="influencer_name[]" id="influencer_name{{ $index }}" />
                    <input type="hidden" value="{{ $item->influencer_email }}" name="influencer_email[]" id="influencer_email{{ $index }}" />
                    @endforeach

Step 2: In the Controller,

Store function:-

Log::info("success m kya aa rha h" . json_encode($request->influencer_email));

$payment = new paypal();
$influencerEmails = $request->session()->get('influencer_email', []);
                $influencerNames = $request->session()->get('influencer_name', []);
                if (!empty($influencerEmails)) {

                    $influencers = [];
                    for ($i = 0; $i < count($influencerEmails); $i++) {
                        $influencers[] = [
                            'influencer_email' => $influencerEmails[$i],
                            // 'influencer_name' => $influencerNames[$i]
                        ];
                    }
                    $payment->influencer_email = json_encode($influencers);
                }
                if (!empty($influencerNames) ) {

                    $influencersname = [];
                    for ($i = 0; $i < count($influencerNames); $i++) {
                        $influencersname[] = [
                            // 'influencer_email' => $influencerEmails[$i],
                            'influencer_name' => $influencerNames[$i]
                        ];
                    }
                    $payment->influencer_name = json_encode($influencersname);
                }

                $payment->save();

Hopefully, It will help You !!!!!!

Related Posts

Top DataOps Pipeline Testing Tools for Modern Data Teams

Introduction Modern data pipelines are complex distributed systems. A standard production workflow connects transactional databases, third-party APIs, object storage, streaming queues, transformation layers, cloud data warehouses, and…

Read More

Accelerating Pipeline Root Cause Analysis Using Telemetry and Graph Intelligence

Modern enterprise data architectures rely on an intricate web of batch jobs, streaming brokers, cloud warehouses, and SaaS APIs where standard task monitoring often falls short—a pipeline…

Read More

AI Agents and the Future of Intelligent Business Automation

Introduction From an engineering leadership perspective, the primary friction in enterprise software today is not model intelligence—it is operational determinism. Software teams can rapidly configure a conversational…

Read More

Building Reliable Software Delivery with DevOps Consulting Services

Introduction Modern engineering organizations face mounting pressure to accelerate deployment frequency without compromising production stability or data security. However, transitioning from fragmented release processes to automated, cloud-native…

Read More

AI Software Development Guide for Startups and Enterprise Teams

Introduction Engineering executives, CTOs, and technical directors face a common operational dilemma: engineering headcount grows, but feature velocity steadily drops. As application architectures expand into distributed services,…

Read More

Website Development Services: What Businesses Should Evaluate Before Hiring

Introduction Most website failures do not start in the design mockups; they originate deep within the backend infrastructure. When leadership teams treat web builds as purely visual…

Read More