使用具有diffForHumans重复天数的Localized Carbon

时间:2018-05-27 17:28:34

标签: php laravel-5 php-carbon

在我的页面中我展示帖子,我使用diffForHumans来显示帖子创建后的时间通过,我用阿拉伯语语言将其翻译为Localized Carbon。 它工作,但在几天内,他显示两天的天数。 例如,而不是5天前显示。他5天前展示了

<div class="row" >
    <!-- properties -->
    @foreach($orderOffers as $key => $offer)
        <div class="col-lg-4 col-sm-6">
            <div class="properties">
                {{$var =\Carbon\Carbon::parse($offer->created_at)}}
                <div class="image-holder"><span><i class="fas fa-hourglass-start"></i>{{LocalizedCarbon::instance($var)->diffForHumans()}}</span>
                    <img src="{{asset($offer->firstimages)}}"  class="img-responsive dimensions" alt="properties">
                    <div class="status sold">
                        @if($offer->negotiable)
                            <i class="far fa-thumbs-up"></i>  قابل للتفاوض
                        @else
                            <i class="far fa-thumbs-down"></i> غير قابل للتفاوض
                        @endif
                    </div>
                </div>
                <h4><a href="property-detail.php">{{$offer->title}}</a></h4>
                <p class="price">{{$offer->price}}<i class="fas fa-hand-holding-usd"></i></p>
                <p class="price">{{$offer->city}} <i class="fas fa-map-marker"></i></p>
                <?php
                $id = $hashids->encodeHex($offer->id);
                ?>
                <a class="btn btn-primary" href="{{route('offer.show',['id'=>$id,'slug'=>$offer->slug])}}">عرض المزيد</a>
            </div>
        </div>
    @endforeach
</div>

0 个答案:

没有答案