示例#1
0
 public function post_edit()
 {
     $rules = array('id' => 'required|exists:unidadmaterial', 'name' => 'required|max:30');
     $validation = Validator::make(Input::all(), $rules);
     if ($validation->fails()) {
         Messages::add('error', $validation->errors->all());
         return Redirect::to('admin/' . $this->controlador . '/edit/' . Input::get('id'))->with_input();
     } else {
         $uni = Unidadmaterial::find(Input::get('id'));
         $uni->nombre = strtoupper(Input::get('name'));
         $uni->save();
         Messages::add('success', 'Unidad Actualizada');
         return Redirect::to('admin/' . $this->controlador . '');
     }
 }
示例#2
0
    foreach (Categoriamaterial::order_by('nombre', 'asc')->get() as $cat) {
        $dataset[$cat->id] = $cat->nombre;
    }
}
echo Form::select('cat_mat_id', $dataset, Input::old('uni_mat_id') || $create ? false : $mat->cat_mat_id);
?>
                        </div>
                    </div>

                    <div class="control-group">
                        {{Form::label('uni_mat_id', 'Unidad',array('class'=>'control-label'))}}
                        <div class="controls">
                            <?php 
$dataset2[''] = 'Seleccione una Unidad';
if (Unidadmaterial::all()) {
    foreach (Unidadmaterial::order_by('nombre', 'asc')->get() as $uni) {
        $dataset2[$uni->id] = $uni->nombre;
    }
}
echo Form::select('uni_mat_id', $dataset2, Input::old('uni_mat_id') || $create ? false : $mat->uni_mat_id);
?>
                        </div>
                    </div>


                </fieldset>

                <div class = "form-actions">                    
                    <input type = "submit" class = "btn btn-primary" value = "{{($create ? 'Crear Material' : 'Guardar Material')}}" />
                    <a class = "btn" href = "{{url('admin/materiales')}}">Regresar</a>
                </div>