Esempio n. 1
0
 public function getPlanes(Request $request)
 {
     if (!$request->ajax()) {
         abort(403);
     }
     $plan = \App\Planes::where('idcarrera', $request->input('carrera'))->where('inactivo', '<>', 0);
     return $plan->get(['id', 'plan']);
 }
Esempio n. 2
0
 public function Planes($action = null)
 {
     if (isset($action)) {
         if ($action == "create") {
             $data = Planes::firstOrCreate(Input::except("_token", "_user"));
             return $respuesta = array('Record' => $data, 'Result' => "OK");
         }
         if ($action == "edit") {
             Planes::where("id", Input::get("id"))->update(Input::except("_token", "id", "_user"));
             return $respuesta = array('Record' => Planes::find(Input::get('id')), 'Result' => "OK");
         }
         if ($action == "remove") {
             Planes::where('id', Input::get("id"))->delete();
             return '{"Result":"OK"}';
         }
         if ($action == "list") {
             $Records = Planes::get();
             $respuesta = array('Records' => $Records, 'Result' => "OK");
             return json_encode($respuesta);
         }
         if ($action == "empresas") {
             $nulos = DB::table('empresas')->select(DB::raw("'NO POSEE' as DisplayText, NULL as Value"));
             $respuesta = DB::table('empresas')->select("nombre as DisplayText", "id as Value")->union($nulos)->orderby('value', 'asc')->distinct()->get();
             return "var opciones=" . json_encode($respuesta);
         }
     }
 }
Esempio n. 3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     Planes::destroy($id);
     return \Redirect::route('planes.index');
 }