/**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['tipo_raza' => 'required']);
     $tipoRaza = \App\TipoRaza::find($id);
     $tipoRaza->tipo_raza = $request->input('tipo_raza');
     $tipoRaza->save();
     $request->session()->flash('msj_success', 'Se ha actualizado la raza: ' . $request->input('tipo_raza'));
     return redirect()->route('tipo-raza.index');
 }
 public function getFiltrarrazas(Request $request)
 {
     if (!$request->ajax()) {
         abort(403);
     }
     $datos = array();
     $inputs = $request->all();
     if (empty($inputs['search'])) {
         $razas = \App\Raza::select(\DB::raw('SQL_CALC_FOUND_ROWS *'), 'id', 'raza', 'id_tipo_raza')->where('id', '>', 0)->take($inputs['limit'])->skip($inputs['offset'])->orderBy('created_at', 'ASC')->get();
     } else {
         $razas = \App\Raza::select(\DB::raw('SQL_CALC_FOUND_ROWS *'), 'id', 'raza', 'id_tipo_raza')->where('raza', 'LIKE', '%' . $inputs["search"] . '%')->take($inputs['limit'])->skip($inputs['offset'])->orderBy('created_at', 'ASC')->get();
     }
     $cantidad = \DB::select(\DB::raw("SELECT FOUND_ROWS() AS total;"));
     $cantidad = $cantidad[0]->total;
     $n = 1;
     foreach ($razas as $raza) {
         $url = '<a href="' . route('raza.edit', $raza->id) . '" class="btn btn-xs btn-success"><i class="fa fa-btn fa-edit"></i>Editar</a>';
         $datos[] = ['num' => $n++, 'raza' => $raza->raza, 'tipo' => \App\TipoRaza::where('id', $raza->id_tipo_raza)->first()->tipo_raza, 'act' => $url];
     }
     return \Response::json(['total' => $cantidad, 'rows' => $datos]);
 }