Php 在vue.js中获取数据
我正在尝试使用控制器中的以下代码将数据库中的数据获取到vue文件:Php 在vue.js中获取数据,php,laravel,vue.js,Php,Laravel,Vue.js,我正在尝试使用控制器中的以下代码将数据库中的数据获取到vue文件: public function forecastModal($store_id = NULL) { $inventory_forecasts = DB::table('restock_inventories', $store_id) ->join('product', function($join){ $join->on('restoc
public function forecastModal($store_id = NULL)
{
$inventory_forecasts = DB::table('restock_inventories', $store_id)
->join('product', function($join){
$join->on('restock_inventories.product_id', '=', 'product.id');
})
->where('product.store_id', $store_id)
->where('product.sku_type', '!=', 'Old Inactive')
->where('restock_inventories.days_of_supply', '<', 14)
// ->distinct()
->select('product.sku', 'restock_inventories.days_of_supply')
->groupBy('product.sku')
->paginate(10);
$data = [
'restock_inventories' => $inventory_forecasts
];
return response()->json($inventory_forecasts);
}
如果我
console.log,我可以获取数组中的数据,但仍然无法获取显示在模态/vue文件中的数据能否为vue
组件提供代码?
getForecastData() {
axios
.post('/inventory-forecast/forecastModal/' + this.store).then(response => {
this.forecastData = response.data
})
},