从数据库中检索数据时出现内部服务器错误错误
这是路线
Route::get('retrieve',function() {
$tourism = \App\Models\Tourism::orderBy('rating','desc')->take(6)->get();
return $tourism;
});
但是当我做的时候
$tourism = \App\Models\Tourism::all()
数据存在。
这是我的javascript
$(document).ready(function(){
var lokasi = [];
var URL = '{{URL::to('/retrieve')}}';
var htmlURL = '{{URL::to('/tourismplace/id/')}}';
$.get(URL).success(function(data){
var jumlahData = data.length;
for(var i=0;i<jumlahData;i++){
lokasi.push({
lat : data[i].latitude,
lon : data[i].longitude,
zoom : 18,
title : data[i].nama,
html : "<a href='"+htmlURL+"/"+data[i].id +"'>"+data[i].nama+"</a>",
icon: 'http://maps.google.com/mapfiles/ms/micons/red-dot.png', // custom icon
animation: google.maps.Animation.DROP
});
}
new Maplace({
locations: lokasi,
map_div: '#gmap-menu',
controls_type: 'list',
show_markers: true,
visualRefresh:true,
controls_on_map:false
}).Load();
console.log(lokasi);
});
});
最后4个日志
#53 C:\xampp\htdocs\skripsiproject\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#54 C:\xampp\htdocs\skripsiproject\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(99): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#55 C:\xampp\htdocs\skripsiproject\public\index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#56 {main}
前4个日志
#0 C:\xampp\htdocs\skripsiproject\vendor\laravel\framework\src\Illuminate\Database\Connection.php(333): PDO->prepare('select * from `...')
#1 C:\xampp\htdocs\skripsiproject\vendor\laravel\framework\src\Illuminate\Database\Connection.php(706): Illuminate\Database\Connection->Illuminate\Database\{closure}(Object(Illuminate\Database\MySqlConnection), 'select * from `...', Array)
#2 C:\xampp\htdocs\skripsiproject\vendor\laravel\framework\src\Illuminate\Database\Connection.php(669): Illuminate\Database\Connection->runQueryCallback('select * from `...', Array, Object(Closure))
#3 C:\xampp\htdocs\skripsiproject\vendor\laravel\framework\src\Illuminate\Database\Connection.php(342): Illuminate\Database\Connection->run('select * from `...', Array, Object(Closure))