试图获取非对象的属性(0)

时间:2019-07-13 01:26:10

标签: php laravel-5

获取数据laravel时出错

我将默认值暂时解决了

 @foreach($directSaleOrders AS $order)
                                        @if(!$order->boughtRequest())
                                            <?php $paymentRow = $order->payment()->where('proccess_type_id', 6)->where('user_id', Auth::id())->orderBy('id', 'DESC')->first(); ?>
                                            @if(in_array($order->status, ['canceled', 'received']))
                                                <?php $status = __('front.my-ads.'.$order->status) ?>
                                            @else
                                                <?php $status = __('front.my-orders.table-headers.done'); ?>
                                            @endif
                                        @else
                                            <?php $paymentRow = $order->winningPayRequest()->where('user_id', Auth::id())->orderBy('id', 'DESC')->first(); ?>
                                            <?php $paymentRow->value = $paymentRow->amount; ?>
                                            @if(in_array($order->status, ['canceled', 'received']))
                                                <?php $status = __('front.my-ads.'.$order->status) ?>
                                            @else
                                                <?php $status = __('front.my-orders.table-headers.'.$paymentRow->status); ?>
                                            @endif
                                        @endif
                                        <tr>
                                            <td>{{ $order->id }}</td>
      <td>{{ date('Y-m-d', strtotime($paymentRow->created_at ?? '0:0:0:0')) }}</td>
                                            <td>
                                                <img class="popup" src="{{ $order->mainImage() }}" style="width: 80px" />
                                            </td>
                                            <td>{{ get_info($order, '_title') }}</td>
                                            <td>{{ $paymentRow->payment_type->{App::getLocale().'_name'} ?? '-'}}</td>
                                            <td>{{ format_numbers($paymentRow->value ?? '0').' '.__('front.page.currency') }}</td>

                                            <td> فشلت عملية الدفع </td>

                                        </tr>
                                        @endforeach

$ paymentRow-> created_at和其他paymentRow未获取期望的第一个值

0 个答案:

没有答案