Problems with paging laravel 5.5 with where

0

I had problems with paging, in this case I can see what is on page one, but when I go to page two nothing appears.

[pagina2

This is my controller, the methods I use for this view are selectord, kissed and reviewed.

<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\User;
use App\Usuarios;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Pagination\Paginator;

class CuentaController extends Controller
{

     /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth');
    }
 

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {

        $user=user::orderBy('id','DESC')->paginate(10);
        return view('usuario.ecuenta',compact('user')); 

    }

  
     /**
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function ugestion(Request $request)
    {
         $valorgestion = $request->valorgestion;
         $userstarea=user::where("username","=",$request->valorgestion)->paginate(6);
         $usuariosOpciones =usuarios::where('asignacion', 'null')->pluck('usuario_ad', 'user_id')->unique();
         return  view('usuario.tareas',compact('userstarea','usuariosOpciones'));
      
    }



     /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function selectord(Request $request)
    {

        $valorusuario = $request->valorusuario;
        $consultarea=usuarios::where('user_id', $request->valorusuario)->paginate(2);
        $usuariosOpciones=usuarios::pluck('usuario_ad', 'user_id')->unique();
        return view('usuario.consultareas',compact('consultarea','usuariosOpciones'));
      
    }
     

     /**
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function bestado(Request $request)
    {
         $valorestado = $request->valorestado;
         $consultarea=usuarios::where('estado','=', $request->valorestado)->paginate(2);
         $usuariosOpciones=usuarios::pluck('usuario_ad', 'user_id')->unique();
         return  view('usuario.consultareas',compact('consultarea','usuariosOpciones'));
      
    }



     /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function revisar()
    {
         $consultarea=usuarios::orderBy('id','DESC')->paginate(2);
         $usuariosOpciones =usuarios::pluck('usuario_ad', 'user_id')->unique(); 
         return view('usuario.consultareas',compact('consultarea','usuariosOpciones'));
      
    }



  
    
 /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function asignar(Request $request)

    {
      $valor = $request->valor;
      $valordos = $request->gestion;
      Usuarios::where('user_id', $valor)->update(['asignacion' => $valordos]);
      return redirect()->route('cuenta.tareas')->with('success','Registro actualizado satisfactoriamente');

    }


  /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function tareas()
    {
         $userstarea=user::where("tipos_usuarios_id","=",3)->paginate(6);
         $usuariosOpciones =usuarios::where('asignacion', NULL)->pluck('usuario_ad', 'user_id')->unique(); 
         return view('usuario.tareas',compact('userstarea','usuariosOpciones'));
      
    }


    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function cestado(Request $request)
     
    {
      $valorestado = $request->confirmar;
      $valorid = $request->idestado;
      Usuarios::where('id', $valorid)->update(['estado' => $valorestado]);
      return redirect()->route('cuenta.revisar')->with('success','Registro actualizado satisfactoriamente');

    }
 


    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        $user=user::find($id);
        return view('usuario.editcuenta',compact('user'));
    }

    /**
     * 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,['name', 'last_name', 'username', 'email', 'password'=>'required|string|min:6|confirmed', 'password_confirmation'=>'required|min:6|same:password']);
 
        user::find($id)->update($request->all());
        return redirect()->route('ecuentas.index')->with('success','Registro actualizado satisfactoriamente');
    }


    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        $tabla=user::find($id)->delete();
        return redirect()->route('ecuentas.index')->with('success','Registro eliminado satisfactoriamente');
    }
}

Will I have to add something to the view?

extends('layouts.layout')
@section('content')
<div class="row">
  <section class="content">
    <div class="col-md-12 col-md-offset-0">
      @if(Session::has('success'))
      <div class="alert alert-info">
        {{Session::get('success')}}
      </div>
      @endif
      <div class="panel panel-default">
        <div class="panel-body">
          <div class="pull-left"><h3>Usuarios confirmados</h3></div>
             <div class="pull-right">
         
          
          <div class="btn-group">
                <div class="col-md-10">

                <form action="{{route('usuario.bestado')}}" method="get">
                    {{csrf_field()}}
                       <select name="valorestado" id="valorestado" class=" form-control"  required>
                          <option value="Pendiente">Pendiente</option>
                          <option value="Descartado">Descartado</option>
                          <option value="Confirmado">Confirmado</option>
                   </select>
                <button class="btn btn-danger btn-xs" type="submit">enviar</button>
             </form>
                   
                 </div>  
              </div>


               <div class="btn-group">
                <div class="col-md-10">

                <form action="{{route('usuario.selectord')}}" method="get">
                    {{csrf_field()}}
                       <select name="valorusuario" id="valorusuario" class=" form-control"  required>
                        @foreach($usuariosOpciones as $user_id => $usuario_ad)
                          <option value="{{ $user_id }}">{{ $usuario_ad }}</option>
                       @endforeach
                   </select>
                <button class="btn btn-danger btn-xs" type="submit">enviar</button>
             </form>
                   
                 </div>  
              </div>


            </div> 
              
           
          <div class="table-container">
            <table id="mytable" class="table table-bordred table-striped table-bordered">
             <thead>
               <th>Usuario_ad</th>
               <th>Nombre</th>
               <th>Apellido</th>
               <th>Cedula</th>
               <th>Telefonos</th>
               <th>Direccion</th>
               <th>barrio</th>
               <th>Lugar_v</th>
               <th>Mesa_v</th>
               <th>Email</th>
               <th>Ciudad</th>
               <th>Estado</th>
               <th>Tipo</th>
             </thead>
             <tbody>
              @if($consultarea->count()) 
              @foreach($consultarea as $usuario)  
              <tr>
                <td>{{$usuario->usuario_ad}}</td>
                <td>{{$usuario->nombre}}</td>
                <td>{{$usuario->apellido}}</td>
                <td>{{$usuario->cedula}}</td>
                <td>{{$usuario->telefonos}}</td>
                <td>{{$usuario->direccion}}</td>
                <td>{{$usuario->barrio}}</td>
                <td>{{$usuario->lugar_votacion}}</td>
                <td>{{$usuario->mesa_votacion}}</td>
                <td>{{$usuario->email}}</td>
                <td>{{$usuario->ciudad}}</td>
                <td>{{$usuario->estado}}</td>
                <td>
                  <form action="{{action('[email protected]')}}" method="post">
                    <select name="confirmar" id="confirmar" class=" form-control" required>
                          <option value="Pendiente">Pendiente</option>
                          <option value="Descartado">Descartado</option>
                          <option value="Confirmado">Confirmado</option>
                   </select>
                    <input type="text" name="idestado" id="idestado" class="form-control input-sm" value="{{{$usuario->id}}}" readonly="readonly" style="visibility:hidden">
                          {{csrf_field()}}
                         <button class="btn btn-info" type="submit"><span>Revisar</span></button>
                   </form>
                </td>
               </tr>
               @endforeach 
               @else
               <tr>
                <td colspan="8">No hay registro !!</td>
              </tr>
              @endif
            </tbody>
          </table>
        </div>
      </div>
      {{ $consultarea->links() }}

    </div>
  </div>
</section>
 
@endsection
    
asked by zereft 12.11.2018 в 23:38
source

0 answers