title: how to store multiple form with multiple buttons data on single page using ajax in laravel
body: <p>This is my form and I don't want to any change or form action and button id:-</p>
  
  <pre><code>&lt;form action="store" method="post"&gt;
  &lt;input type="text" class="form-control" id="add_related_product" name="addons_heading" value="&lt;?php if (isset($setting['addons_heading'])){echo htmlentities($setting['addons_heading']);}?&gt;"&gt;
  &lt;input type="text" class="form-control" id="label_quantity" name="quantity" value="&lt;?php if (isset($setting['quantity'])){echo $setting['quantity'];}?&gt;"&gt;
  &lt;button type="button" onclick="saveAjaxSetting()" class="sg-main-btn sg-primary-btn" id="ajaxSubmit"&gt;Save&lt;/button&gt;
  &lt;/form&gt;
  
  &lt;form action="store" method="post"&gt;
  &lt;input type="number" class="form-control" id="max_accessories" name="max_accessories" value="&lt;?php if (isset($setting['max_accessories'])){echo $setting['max_accessories'];}?&gt;"&gt;
  &lt;input type="text" class="form-control" id="max" name="max" value="&lt;?php if (isset($setting['max'])){echo $setting['max'];}?&gt;"&gt;
  &lt;button type="button" onclick="saveAjaxSetting()" class="sg-main-btn sg-primary-btn" id="ajaxSubmit"&gt;Save&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>This is my route:-
      Route::post('/store','Crud\SettingController@saveSetting');</p>
  
  <p>here is my setting controller:-</p>
  
  <pre><code>public function saveSetting(StoreSetting $request)
  {
      try{
          //Log::info($request);
          $setting= request(['is_active','max_accessories','quick_view','accessory_discription','thumbnail','quantity_selector','addons_heading','quantity','variant','price']);
  
          $data= array_map(array($this,'settingData'), array_keys($setting), array_values($setting));
  
          $keys=array_keys($setting);
          //Log::info($data);
          if (!empty($data))
          {
              Model::whereIn('entity_name',$keys)-&gt;delete();
              $settingData= Model::insert($data);
              return true;
          }
          return false;
  
      }
      catch (\Exception $e) {
          Log::error($e-&gt;getMessage());
          throw new \Exception("Setting not saved in ");
          return false;
      }
  }
  </code></pre>
  
  <p>And my ajax script is:-</p>
  
  <pre><code>function saveAjaxSetting(data) {
  console.log(data);
  $.ajax({
      type: 'POST',
      url: "/spiceaddons/public/store",
      dataType: 'json',
      data: {
          "method": 'POST',
          "data": data
      },
      error: function (err) {
          console.log(err);
          toastr.error('Error in saved');
      },
      success: function (data) {
          console.log(data);
          toastr.success(' Setting saved');
  
      },
  });
  </code></pre>
  
  <p>}</p>
  
  <p>This is all of the code is here
  And
  Problem:- data not insert in database.</p>