public function listStudentData() {
$list = Student::all()->sortByDesc("first_name");
return Datatables::of($list)
->make(true);
}
这不起作用!!
答案 0 :(得分:0)
取决于您是要使用id
还是created_at
时间戳:
$students = Student::orderBy('id', 'desc')->get();
// or
$students = Student::orderBy('created_at', 'desc')->get();
答案 1 :(得分:0)
您始终可以在查询中使用latest():
jQuery(document).ready(function(){
jQuery('#shopping-cart-table')
.on(
'change',
'input[name$="[qty]"]',
function(){
var form = jQuery(jQuery(this).closest('form'));
// we'll extract the action and method attributes out of the form
// kick off an ajax request using the form's action and method,
// with the form data as payload
jQuery.ajax({
url: form.attr('action'),
method: form.attr('method'),
data: form.serializeArray()
});
}
);