Skip to content

Instantly share code, notes, and snippets.

@dannymichel
Created June 4, 2016 22:23
Show Gist options
  • Save dannymichel/2f55ad667d5820ec56dca1c451b65ad1 to your computer and use it in GitHub Desktop.
Save dannymichel/2f55ad667d5820ec56dca1c451b65ad1 to your computer and use it in GitHub Desktop.
public function postVendorCreateItems ()
{
$input = Input::all();
$validator = Validator::make($input,
[ 'item_name' => 'max:50',
'normalprice' => 'numeric',
'karmaprice' => 'numeric',
'asin' => 'max:50',
'sizes' => 'max:50',
]);
if($validator->passes())
{
$items = new Item();
$items->brand_id = $input['brand_id'];
$items->name = $input['item_name'];
$items->normalprice = $input['normalprice'];
$items->karmaprice = $input['karmaprice'];
$items->asin = $input['asin'];
$items->sizes = $input['sizes'];
$items->save();
return Redirect::route('account-vendor-index')
->with('global', 'You have successfully created an item.');
}
return Redirect::route('account-vendor-index')
->withErrors($validator)
->with('global', 'Your could not be created.');
}
<div class="form-group">
<label class="col-xs-3 control-label">Sizes</label>
<div class="col-xs-9">
<select id="selectSizes" multiple="multiple" class="form-control selectSizes" name="sizes[]">
<option value="XS (0-2)">XS (0-2)</option>
<option value="S (4-6)">S (4-6)</option>
<option value="M (8-10)">M (8-10)</option>
<option value="L (12-14)">L (12-14)</option>
<option value="XL (16-18)">XL (16-18)</option>
<option value="XXL (20-22)">XXL (20-22)</option>
</select>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment