doulin9679 2018-10-25 06:22
浏览 39

双环foreach laravel 5.5刀片

Tying to access item tables in first loop and values of the 2nd loop in a select in laravel. How do i do this? I get an error:

Trying to get property 'unit_abb' of non-object (View: C:\xampp\htdocs\ein\IPPSesources\views\pr-items.blade.php)

Here is my code: pr-items.blade

@foreach($list as $indexKey => $list)
  <form class="form-horizontal" role="form" method="POST" action="{{ url('/update_items',$list->id) }}" autocomplete="off" >
    {{ csrf_field() }}
    {{ method_field('PATCH') }}
    <input type="hidden" value="{{$list->pr_form_number}}" name='prlist' id='prlist'>
  <tr>
    <th>

    </th>
    <td>
      <input type="text" class="form-control custom-border input-sm" value="{{$list->pr_qty}}" name="qtylist" id="qtylist" >
    </td> 
    <td>
      <select id="department" type="text" class="form-control custom-border input-sm" name="unitlist" id="unitlist">
        @foreach ($units as $key => $newunit)
          @if ($loop->parent->first)
            <option value="{{$newunit->unit_abb}}" @if($newunit->unit_abb == $list->pr_unit) selected @endif>{{$newunit->unit_name}}</option>
          @endif

        @endforeach               
      </select>
    </td>
        <td>
     <input type="text" class="form-control custom-border input-sm" value="{{$list->pr_description}}" name="descriptionlist" id="descriptionlist" >
    </td> 
    <td>
      <input type="text" class="form-control custom-border input-sm money-inp" value="{{$list->pr_cost_per_unit}}" name="cpulist" id="cpulist">
    </td>
    <td>
      <input type="text" class="form-control custom-border input-sm money-inp" value="{{$list->pr_estimated_cost}}" disabled>
    </td> 

    <td class="text-center">
      <button type="submit" class="btn btn-warning btn-sm glyphicon glyphicon-pencil"></button>
      <a class="btn btn-danger btn-sm glyphicon glyphicon-minus" href="{{route('pr.delete',$list->id)}}"></a>
    </td>
    </tr>
    </form> 
@endforeach
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡等级和折扣规则
    • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
    • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
    • ¥15 gdf格式的脑电数据如何处理matlab
    • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
    • ¥100 监控抖音用户作品更新可以微信公众号提醒
    • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
    • ¥70 2048小游戏毕设项目
    • ¥20 mysql架构,按照姓名分表
    • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分