ist irgendetwas mit meinem folgenden Code falsch? caz es zeigt immer: 500 (Internal Server Error) Ich weiß nicht, warum und alle hoffen kann helfen, danke ...Laravel mit ionic: 500 (Interner Serverfehler)
ich für einen Tag gesucht, aber ohne Lösung. Fehle ich etwas? Und ich verwende ionische, um die mobile Anwendung zu tun.
// Controller
public function touristsData(){//get
$postdata = file_get_contents("php://input");
$request = json_decode($postdata,true);
$location = $request['location'];
if(empty($location) != true){
$tourists = User::where('block','0')
->where('location', $location)
->orderBy('updated_at', 'desc')
->get();
}else{
$tourists = User::where('block','0')
->orderBy('updated_at', 'desc')
->get();
}
return View::make('frontend.data.touristsData',array('tourists'=>$tourists));
}
//app.js(angularjs)
$scope.submitForm = function(){
if($scope.filter.want == 'company'){
$http({
method : 'POST',
url : './touristsData',
beforeSend: function (xhr) {
var token = document.getElementById('token').getAttribute('content');
if (token) {
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
}
},
data : {
'location': $scope.filter.location
},
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
})
.success(function(data){
$scope.tourists = data;
});
$scope.modal.hide();
}
}
Vielen Dank!
Veröffentliche keine neue Frage - bearbeite diese stattdessen. –
Entschuldigung für die verspätete Antwort. und warum benutzen Sie kompakt ("Touristen")? – franklee
Es ist das selbe wie 'array (' touristen '=> $ tourists)' zu nennen, nur kürzer. http://php.net/manual/en/function.compact.php –