I have this question of how to put the vot% ver resultados
in the datatable, the way in which I do the consultations is like this:
route::get('api/users', function(){
return datatables()->eloquent(App\Usuario::query())->toJson();
});
and so I have the script
<script>
$(document).ready( function () {
$('#users').DataTable({
processing: true,
serverSide: true,
ajax: 'api/users',
"columns":[
{ data: 'id_usu'},
{ data: 'nombre'},
{ data: 'email'},
{ data: 'edad'},
{ data: 'sexo'},
{ data: 'escolaridad'},
{ data: 'photo'},
]
});
} );
</script>
the button I would like to appear is this
'<td><a href="{{ URL::action('UsuariosController@verRes', $usu->id_usu) }}"><button class="btn btn-success">Ver Detalles</button></a></td>'
I tried this with
$users = User::select(['id', 'name', 'email', 'password', 'created_at', 'updated_at'])->get();
return Datatables::of($users)
->addColumn('action', function ($user) {
return '<a href="#edit-'.$user->id.'" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a>';
})
->editColumn('id', 'ID: {{$id}}')
->removeColumn('password')
->make(true);
}
and adding this in the script
{data: 'action', name: 'action', orderable: false, searchable: false}
But I get an error that you do not find the action
.
It should be noted that I have changed the variables as long as they fit with my database and my model, any suggestions?