我一直在尝试将我的网络应用程序连接到名为 app42-apphq.shephertz.com 的 BaaS
有关于如何做的指南吗?我试图阅读文档并已连接,但问题是显示对我的视图的 json 响应,因为响应是通过两个数组循环的。
这是我的控制器功能
$storageService = App42API::buildStorageService();
$inventory = $storageService->findAllDocuments($dbName,$collectionName);
$jsonDocList = $inventory->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
$products = json_decode($jsonDoc->getJsonDoc());
for($i=0;$i<=count($products);$i++)
{
print($products->productDescription);
print($products->productName);
print($products->productPrice);
}
}
这是我的观点
@extends('templates.home.another')
@section('content')
<div class="container" style="margin-left:270px; width:70%; margin- top:60px;">
<div class="col-lg-8">
<table id="app42sales" class=" table table-striped" >
<thead>
<tr>
<th>ID</th>
<th>Transaction Type</th>
<th>Number of items</th>
<th>Total Cost</th>
<th>Week of year</th>
<th>Year</th>
<th>Date</th>
<th>Date of year</th>
</tr>
</thead>
<tbody>
@foreach($jsonDoc as $doc)
{
@foreach($records as $record)
<?php $i = 1; ?>
<tr>
<td>{{ $i }}</td>
<td>{{ $record->transactionType }}</td>
<td>{{ $record->numberOfItems }}</td>
<td>{{ $record->totalCost }}</td>
<td>{{ $record->weekOfYear }}</td>
<td>{{ $record->year }}</td>
<td>{{ $record->date }}</td>
<td>{{ $record->dayOfYear }}</td>
</tr>
<?php $i++ ;?>
@endforeach
}
@endforeach
</tbody>
</table>
</div>
</div>
@endsection