public function up() { $rubro = new Rubro(); $rubro->nombre = 'Deporte'; $rubro->save(); $rubro = new Rubro(); $rubro->nombre = 'Arte'; $rubro->save(); }
public function getEditArticulo($id_articulo) { $articulo = Articulo::find($id_articulo); $rubros = Rubro::all(); $proveedores = Proveedor::all(); if (is_null($articulo)) { App::abort(404); } return View::make('edit_articulo')->with('articulo', $articulo)->with('rubros', $rubros)->with('proveedores', $proveedores); }
/** * API Method inserts a new Rubro record and render response as JSON */ public function Create() { try { $json = json_decode(RequestUtil::GetBody()); if (!$json) { throw new Exception('The request body does not contain valid JSON'); } $rubro = new Rubro($this->Phreezer); // TODO: any fields that should not be inserted by the user should be commented out // this is an auto-increment. uncomment if updating is allowed // $rubro->Id = $this->SafeGetVal($json, 'id'); $rubro->Nombre = $this->SafeGetVal($json, 'nombre'); $rubro->Validate(); $errors = $rubro->GetValidationErrors(); if (count($errors) > 0) { $this->RenderErrorJSON('Please check the form for errors', $errors); } else { $rubro->Save(); $this->RenderJSON($rubro, $this->JSONPCallback(), true, $this->SimpleObjectParams()); } } catch (Exception $ex) { $this->RenderExceptionJSON($ex); } }
public function all_rubros() { $rubros = Rubro::all(); return View::make('lista_rubros')->with('rubros', $rubros); }
<tr> <th>Articulo</th> <th>Rubro</th> <th>Proveedor</th> <th>Precio Base</th> <th>Utilidad</th> <th>Iva</th> <th>Precio Precio Publico</th> <th>Accion</th> </tr> </thead> <tbody> <?php foreach ($articulos as $articulo) { $rubro = Rubro::find($articulo->rubros_id); $proveedor = Proveedor::find($articulo->proveedors_id); echo "<tr>"; echo "<td>" . $articulo->articulo . "</td>"; echo "<td>" . $rubro->rubro . "</td>"; echo "<td>" . $proveedor->proveedor . "</td>"; echo "<td>" . $articulo->precio_base . "</td>"; echo "<td>" . $articulo->utilidad . "</td>"; echo "<td>" . $articulo->iva . "</td>"; echo "<td>" . $articulo->precio_publico . "</td>"; echo "<td>"; echo "<a href='/articulos/" . $articulo->id . "/edit' class='btn btn-xs btn-primary'>Editar</a> "; echo "<a href='/articulos/" . $articulo->id . "' class='btn btn-xs btn-info'>Ver</a> "; print "</td>"; print "</tr>"; }
public function postAgregar() { $nueva_queja = new Queja(); $file = Input::file("foto"); $nueva_queja->rubro_id = Input::get('rubro_id'); $nueva_queja->usuario_id = Input::get('usuario_id'); $nueva_queja->descripcion = Input::get('descripcion'); $nueva_queja->gravedad = Input::get('gravedad'); if (Input::hasFile('foto')) { $nueva_queja->foto = Input::file("foto")->getClientOriginalName(); //nombre original de la foto $file->move("img/upload/queja_file", $file->getClientOriginalName()); } $nueva_queja->save(); $departamento = Rubro::select('departamento.nombre', 'rubro.descripcion')->leftJoin('departamento', 'rubro.departamento_id', '=', 'departamento.id')->where('rubro.id', '=', Input::get('rubro_id'))->first(); Mail::send('emails.new_queja', array('descripcion' => Input::get('descripcion'), 'departamento' => $departamento->nombre, 'rubro' => $departamento->descripcion, 'queja_id' => $nueva_queja->id), function ($message) { /*$message->to('*****@*****.**')->subject('Notificacion de nueva queja');*/ $message->to('*****@*****.**')->subject('Notificacion de nueva queja'); }); return Redirect::to('queja')->with('status', 'nueva'); }