public function byId($id)
 {
     $practicante = Practicante::find($id);
     if (!$practicante) {
         return response()->json(['error' => ['message' => 'Practicante no existe']], 404);
     }
     return response()->json($practicante, 200);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $usr = Practicante::where('email', '=', $request->user()->email)->get();
     $actual_rank = Tag::where('name', Config::get('constants.ranks')[$usr[0]->actual_rank])->get()[0]->id;
     $withTags = DB::table('article_tag')->where('tag_id', $actual_rank)->get(array('article_id'));
     //Cleaning the array
     $justTags = array();
     foreach ($withTags as $key => $value) {
         array_push($justTags, $value->article_id);
     }
     $articles = Article::whereIn('id', $justTags)->get();
     return View('practicante.tecnicas.index')->with('articles', $articles)->with('actual_rank', $usr[0]->actual_rank)->with('ranks', Config::get('constants.ranks'));
 }
 protected function postRegister(UserRequest $request)
 {
     $exist = Practicante::where('email', $request->email)->get();
     if (count($exist) == 1) {
         $user = new User($request->all());
         $user->password = bcrypt($request->password);
         $user->save();
         Flash::success("Se ha registrado el usuario " . $user->name . " de manera exitosa! Ya puedes hacer login");
         return redirect()->route('admin.auth.login');
     } else {
         Flash::success("El correo no es válido");
         return redirect()->route('admin.auth.register');
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $practicante_id = Practicante::where('email', $request->user()->email)->get()[0]->id;
     $pagos = Pago::where('practicante_id', $practicante_id)->orderBy('fecha_pago', 'desc')->paginate(10);
     return view('practicante.pagos.index')->with('pagos', $pagos)->with('conceptos', Config::get('constants.conceptos'));
 }
 public function edit($id)
 {
     $practicante = Practicante::find($id);
     return view('admin.practicantes.edit')->with('practicante', $practicante)->with('ranks', Config::get('constants.ranks'))->with('type', Config::get('constants.type'))->with('dojos', Config::get('constants.dojos'))->with('cursos', Config::get('constants.cursos'));
 }
 public function create(Request $request, $id)
 {
     $practicante = Practicante::find($id);
     return view('admin.pagos.pay')->with('practicante', $practicante)->with('dojos', Config::get('constants.dojos'))->with('ranks', Config::get('constants.ranks'))->with('type', Config::get('constants.type'))->with('conceptos', Config::get('constants.conceptos'));
 }