Nov 9, 2015
0
Level 1
Render only one table of the pagination
this is my actually controller class ProblemaController extends Controller { public function show($id) {
$problema = Problema::findOrFail($id);
$casos = DB::table('caso')->paginate(1);
$comentarios = DB::table('comentario')->paginate(2);
$pistas = DB::table('pista')->paginate(7);
return view('problema.show')->with('problema', $problema)
->with('casos', $casos)
->with('pistas', $pistas)
->with('comentarios', $comentarios);
} }
VIew
@foreach ($casos as $i)
@if($i->id_problema == $problema->id_problema)
<tr class="succes">
<td>
{{ $cont++ }}
</td>
<td>
@if ($profesor)
<a href="{{action('CasoController@show', [$i->id_caso]) }}">
{{ $i->id_caso }}
</a>
@else
{{ $i->id_caso }}
@endif
</td>
<td>
{{ $i->puntos }}
</td>
</tr>
@endif
@endforeach
<?php$cont=1; ?>
{!! $casos->render() !!}
Pistas del problema:
@foreach ($pistas as $i)
@if($i->id_problema == $problema->id_problema)
<tr class="succes">
<td>
{{ $cont++ }}
</td>
<td>
{{ $i->id_pista }}
</td>
<td>
{{ $i->titulo }}
</td>
<td>
{{$i->puntos}}
</td>
<td>
@if ($i->usuarios->find($usuario->id))
<a href="{{action('PistaController@show', [$i->id_pista]) }}">
Ver
</a>
@else
<a href="{{action('PistaController@comprar', [$i->id_pista]) }}">
Comprar
</a>
@endif
</td>
</tr>
@endif
@endforeach
<?php $cont=1; ?>
{!!$pistas->render()!!}
Comentarios del problema por aprobar:
<th>#</th>
<th>id</th>
<th>Comentario</th>
<th>Fecha</th>
<th>Accion</th>
@foreach ($comentarios as $i)
@if (!$i->profesor)
@if($i->id_problema == $problema->id_problema)
<tr class="succes">
<td>
{{ $cont++ }}
</td>
<td>
{{ $i->id_comentario }}
</td>
<td>
{{ $i->comentario }}
</td>
<td>
{{$i->created_at}}
</td>
<td>
<div id="general" >
<div id="especifico2" >
{!! Form::model($i, ['class' => 'delete', 'method' => 'DELETE',
'action' => ['ComentarioController@destroy',
$i->id_comentario]]) !!}
{!! Form::submit('Eliminar') !!}
{!! Form::close() !!}
</div>
<div id="especifico2" >
<a href="{{action('ComentarioController@aprobar', [$i->id_comentario]) }}">
<button type="button" name="button">Aprobar</button>
</a>
/
</div>
</td>
</tr>
@endif
@endif
@endforeach
<?php $cont=1; ?>
{!!$comentarios->render()!!}
Route Route::get('problema/{id}', 'ProblemaController@show');
So how I can do, that the render keeps separate from each table, than when I pick to see a second page of the pagination don't change to the second page of all the tables.
Really need help!! Thanks
Please or to participate in this conversation.