我刚刚购买了一个由Laravel和AngularJS构建的脚本(来自codecanyon),现在,当我试图从SQL获取“DB :: raw”(在后端显示一个表)它给我一个错误:laravel + AngularJs:不能执行SQL命令
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'pushes.title' in 'field list' (SQL: select pushes.title, pushes.created_at ....
我能理解错误,没有在SQL表“pushes.title”,它看起来像所有的JS对象不转换为值,例如“pushes.title”应该是数据库中的“标题”,等等。
这里是发送get命令功能:
public function getDataReport($filters=array(),$orders=array()){
$pushes = \Push::select(\DB::raw(" pushes.title, pushes.created_at, pushes.id as pushes_id, pushes.message, pushes.notify_trigger, pushes_to_locations.id as pushes_to_locations_id, pushes_to_locations.location_id, pushes_to_locations.status, locations.lat, locations.address_formated, locations.lng, locations.radius")); $pushes->join('pushes_to_locations','pushes.id','=','pushes_to_locations.pushes_id'); $pushes->join('locations','locations.id','=','pushes_to_locations.location_id'); if(!empty($filters['status'])){ $pushes->whereRaw("(status = ".$filters['status'].")"); } if(!empty($filters['text'])){ $pushes->where("title",'like',"%".$filters['text']."%"); $pushes->orWhere("message",'like',"%".$filters['text']."%"); } $noSort = true; foreach($orders as $col => $orderValue) { if(empty($orderValue)) { continue; }; $noSort = false; $pushes->orderBy($col,$orderValue); } if(($noSort)){ //$orderColumns['order_date'] ='DESC'; $pushes->orderBy('pushes.created_at','desc'); } //echo $apps->toSql(); return $pushes->paginate(20); } }
缺少什么我在这里?我需要安装其他东西吗?
这里是后端说明:
http://ec2-54-179-166-43.ap-southeast-1.compute.amazonaws.com/geofencing/public/backend-guide
(所有的休息是完全为我工作,所以我认为大多数安装的是罚款)
在此先感谢!
伊兰。
错误消息说''pushes'表中不存在'title'列。什么是混乱? –
它是存在的,错误说:“pushes.title”是不存在的,而事实上它不是.. –
对不起,您的评论是没有意义的。 –