DEV Community

Remon Hasan
Remon Hasan

Posted on

1

Shopping Cart Laravel 8: part 03

Alt Text

Source Code

Github

Add to cart

Now we have to pick the add to cart of product by using wire bind as like:

wire:click.prevent="store({{$product->id}},'{{$product->name}}',{{$product->regular_price}})"

Additionally, we can use the method of count() for checking there is any product or not! For that we can use the loop like:

@if(Cart::count()>0)
// go for product
else
No Products
@endif

Fetch product image from database

src="{{asset('assets/images/products')}}/{{$item->model->image}}"

Route action

href="{{route('product.details',['slug'=>$item->model->slug])}}"

Rest of the functions of building cart package

  1. Subtotall
  2. Total
  3. Tax

Alt Text

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Best practices for optimal infrastructure performance with Magento

Running a Magento store? Struggling with performance bottlenecks? Join us and get actionable insights and real-world strategies to keep your store fast and reliable.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️