Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

92
Views
How to save multiple checkbox Label Text into database in Laravel

I'm trying to save multiple Label Text of Checkboxes. First, I'm saving chechbox value in a column of database table. But other than that, I have to save Label of each those checkbox checked in another column of table.

My table:

 Schema::create('restaurant_offers', function (Blueprint $table) {
                $table->increments('id');
              .......
                $table->string('additionalOptions')->nullable();
                $table->string('additionalOptionsSum')->nullable();
                ......
            });

My blade:

<label class="form-check-label" for="additionalOptionsSum" >
    <input class="form-check-input calc" type="checkbox" id="additionalOptionsSum" name="additionalOptionsSum[]" value="19"> Delivery System 
    </label>
<label class="form-check-label" for="additionalOptionsSum" >
    <input class="form-check-input calc" type="checkbox" id="additionalOptionsSum" name="additionalOptionsSum[]" value="29"> Takeaway System 
    </label>
<label class="form-check-label" for="additionalOptionsSum" >
    <input class="form-check-input calc" type="checkbox" id="additionalOptionsSum" name="additionalOptionsSum[]" value="39"> Table Reservation System 
    </label>

My Controller:

$data = new RestaurantOffer;

         ......
         $data["additionalOptionsSum"] = implode(",", $request->get("additionalOptionsSum"));
         $data["additionalOptions"] = implode(',', $request->get("aditionaloptions"));

So, I have to save values and labels text of each checkbox checked as array in database. Values of additionalOptionsSum is working well. Now, I have to save additionalOptions too.

Example, if I check two checkboxes, the table in database, should be like this:

id| additionalOptions| additionalOptionsSum|
-----------------------------
1 | Delivery System, | 19, 29|
    Takeaway System

For the moment it is looking like this:

id| additionalOptions| additionalOptionsSum|
    -----------------------------
    1 |              | 19, 29|

Thank you in advance

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!