public function run() { $i = 1; DB::table('directiva')->delete(); $directiva[] = array("nombre" => "Fulano de Tal", "Cargo" => "Presidente de la junta Directiva", "email" => "*****@*****.**", "telefono" => "123456789"); $directiva[] = array("nombre" => "Mengana", "Cargo" => "Secretario", "email" => "*****@*****.**", "telefono" => "123456789"); $directiva[] = array("nombre" => "Pedro Pérez", "Cargo" => " Tesorero", "email" => "*****@*****.**", "telefono" => "123456789"); $directiva[] = array("nombre" => "Ana Rojas", "Cargo" => "Administrador", "email" => "*****@*****.**", "telefono" => "123456789"); $directiva[] = array("nombre" => "Juan Gonzalez", "Cargo" => "Consejal", "email" => "*****@*****.**", "telefono" => "123456789"); Directiva::insert($directiva); $this->command->info('Directiva Table Seed!'); }
public function Directiva($action) { if (isset($action)) { if ($action == "create") { $data = Directiva::firstOrCreate(Input::all()); return $respuesta = array('Record' => $data, 'Result' => "OK"); } if ($action == "edit") { Directiva::where("id", Input::get("id"))->update(Input::except("id")); return $respuesta = array('Record' => Directiva::find(Input::get('id')), 'Result' => "OK"); } if ($action == "remove") { Directiva::where('id', Input::get("id"))->delete(); return '{"Result":"OK"}'; } if ($action == "list") { $Records = Directiva::get(); $respuesta = array('Records' => $Records, 'Result' => "OK"); return json_encode($respuesta); } } }
/** * Display a listing of the resource. * GET /directivas * * @return Response */ public function index() { return Directiva::all(); }
public function verdirectiva() { $directiva = Directiva::select("nombre", "cargo", "telefono", "email")->get(); return View::make('directiva')->with('directiva', $directiva); }