dimanche 25 février 2018

laravel return try non-object in vps

I have problem when upload my website to VPS. When I run it in my local server, it works, but after when it on online server it return error "Trying to get property of non-object"

my controller:

public function index()
{   
    $variants = ProductVariant::hasStock()->get();
    return view('storefront.account.shop')->with('variants', $variants);
}

my blade:

 @foreach($variants as $variant)
                                <div class="item">
                                    <div class="row">
                                        <div class="col-md-3">
                                            <img src="">
                                            <p class="m-t"></p>
                                            <p>Rp.</p>
                                        </div>
                                        <add-to-bag variant="" stock=""
                                                    inline-template>
                                            <div>
                                                <div class="col-md-3">
                                                    @if ($variant->stock >= \App\Setting::getString(\App\Setting::LOYALTY_RESELLER_MINIMUM_LEVEL_1))
                                                        <select name="quantity" v-model="quantity">
                                                            <option v-for="n in _.range(minimal_order, parseInt(this.stock) + 1)"
                                                                    :value="n">@</option>
                                                        </select>
                                                    @endif
                                                </div>
                                                <div class="col-md-3 item-btn">
                                                    @if (data_get(auth()->user(), 'is_reseller') && $variant->stock < \App\Setting::getString(\App\Setting::LOYALTY_RESELLER_MINIMUM_LEVEL_1))
                                                        <button class="btn btn-plain-red m-b-lg" disabled>
                                                            OUT OF STOCK
                                                        </button>
                                                    @else
                                                        <button class="btn btn-dark" @click="add">ADD TO BAG</button>
                                                    @endif
                                                </div>
                                            </div>
                                        </add-to-bag>
                                    </div>
                                </div>
                            @endforeach



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire