public function addAction() { $this->addForm = new ProveedorForm(); $object; if ($this->addForm->isPosted()) { $xi = 0; //while($xi<3){ if ($this->addForm->isValidForAdd($xi)) { if (Input::get($this->FieldsCreate['4']['name'] . $xi) == true) { //disponible $disponiblechk = Input::get($this->FieldsCreate['4']['name'] . $xi); } else { $disponiblechk = false; } $object = Proveedor::create([$this->FieldsName['1'] => Input::get($this->FieldsCreate['1']['name'] . $xi), $this->FieldsName['2'] => Input::get($this->FieldsCreate['2']['name'] . $xi), $this->FieldsName['3'] => Input::get($this->FieldsCreate['3']['name'] . $xi), $this->FieldsName['4'] => $disponiblechk]); return Redirect::route($this->routeIndex); } else { } //$xi++; //} return Redirect::route($this->routeAdd)->withInput(["errors" => $this->addForm->getErrors()]); //return Redirect::route($this->routeAdd)->withInput(Input::all()); //} } $this->addrow = $this->addrowAction(); return View::make($this->routeAdd, ["form" => $this->addForm, "row" => $this->addrow, "FieldsCreate" => $this->FieldsCreate, "module" => $this->module, "key" => $this->key]); }
public function run() { $object = [["NOMBRE" => "PROVEEDOR1", "RANKING" => "55", "DESCRIPCION" => "DIRECCION: Tr 12 # 15-12, TEL 2355555, EMAIL: al55@gmail.de "], ["NOMBRE" => "PROVEEDOR2", "RANKING" => "12", "DESCRIPCION" => "DIRECCION: Tr 25 # 15-25, TEL 2252525, EMAIL: qwe25@gmail.de "], ["NOMBRE" => "PROVEEDOR25", "RANKING" => "65", "DESCRIPCION" => "1DIRECCION: Tr 34 # 15, TEL 2324456, EMAIL: wer5@gmail.de "], ["NOMBRE" => "PROVEEDOR40", "RANKING" => "99", "DESCRIPCION" => "1DIRECCION: Tr 34 # 15, TEL 2324456, EMAIL: dfg56l@gmail.de "]]; DB::unprepared('ALTER TABLE ' . $this->table . ' AUTO_INCREMENT = 1'); foreach ($object as $detail) { Proveedor::create($detail); } }