I am using laravel with mysql. I am trying to create a simple form which will create 2 records in DB table. The code was working for for add/edit single record but I am not sure whats going wrong here as I have been following other examples on Stack overflow.
My Controller:
function getAdd( $id = null)
{
$id = ($id == null ? '' : SiteHelpers::encryptID($id,true)) ;
$row = $this->model->find($id);
if($row)
{
$this->data['row'] = $row;
} else {
$this->data['row'] = $this->model->getColumnTable('dates');
}
/* Master detail lock key and value */
if(!is_null(Input::get('md')) && Input::get('md') !='')
{
$filters = explode(" ", Input::get('md') );
$this->data['row'][$filters[3]] = SiteHelpers::encryptID($filters[4],true);
}
/* End Master detail lock key and value */
$this->data['masterdetail'] = $this->masterDetailParam();
$this->data['filtermd'] = str_replace(" ","+",Input::get('md'));
$this->data['id'] = $id;
$this->layout->nest('content','feeDate.form',$this->data)->with('menus', $this->menus );
}
My Form (right now Just a basic form to check multiple inserts):
{{ Form::open(array('url'=>'fee/save/'.Helpers::encryptID($row['id']).'?md='.$filtermd.$trackUri, 'class'=>'form-horizontal','files' => true , 'parsley-validate'=>'','novalidate'=>' ')) }}
<table>
<tr>
<th>Cat</th>
<th>Date</th>
</tr>
<?php
for ($x = 1; $x <= 2; $x++) {
?>
<tr>
<td>
{{ Form::text('Cat', $row['Cat'],array('name'=>'Cat[]', 'class'=>'form-control', 'placeholder'=>'', )) }}
</td>
<td>
{{ Form::text('Date', $row['Date'],array('name'=>'Date[]', 'class'=>'form-control', 'placeholder'=>'', )) }}
</td>
</tr>
<?php
}
?>
</table>
<input type="submit" name="submit" class="btn btn-primary" value="Save" />
{{ Form::close() }}
Error I am getting: preg_replace(): Parameter mismatch, pattern is a string while replacement is an array
laravel php laravel 5 laravel 4 laravel with laravel tutorial
Aucun commentaire:
Enregistrer un commentaire