samedi 22 février 2020

Get values from blade to Model function Laravel

Am trying to import excel file. From current state I can upload the file, But I want insert excel file on each different table depending on the values in the combo box. ie if Value is A insert into tableA,Value is B insert into tableB like that. Am looking for, is it possible to check the values in the route and call model function.

Blade file

<form id="ExcelImportForm" method="post" enctype="multipart/form-data" action="">
   <table class="table">
      <tr>
         <td>Select Project *</td>
         <td>
            <select required class="form-control" name="ExcelProject" id="ExcelProject">
               <option selected disabled>Select Technology</option>
               <option value="A">A</option>
               <option value="B">B</option>
               <option value="C">C</option>
               <option value="D">D</option>
            </select>
         </td>
      </tr>
      <tr>
         <td>Select File *</td>
         <td><input class="form-control" type="file" id="file" name="file" required  ></td>
      </tr>
      <tr>
         <td></td>
         <td><button type="submit" id="ExcelMasterBtn" class="btn btn-success pull-right"><i class="fa fa-upload"></i> Upload</button></td>
      </tr>
   </table>
</form>

Below give is route which is working in single case, is it possible to implement an if statement inside that.

route.php

Route::get('/upload-panel/', function () {
    (new  \App\Http\Model\Excelentry())->importToDb();

        return view('admin.upload-panel.excel-upload-panel');
});

Or anyother way to get this combobox value inside the model function



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire