Practical Livewire 3: Order Management System Step-by-Step

In this lesson, we will use Laravel Excel package to export selected products into CSV, XLSX, and PDF.

Let's start by adding three buttons, which will trigger the export() method in the Livewire component.


<div class="mb-4">
<div class="mb-4">
<a class="inline-flex items-center px-4 py-2 text-xs font-semibold tracking-widest text-white uppercase bg-gray-800 rounded-md border border-transparent hover:bg-gray-700">
Create Product
<button type="button"
@disabled(! $this->selectedCount)
class="px-4 py-2 mr-5 text-xs text-red-500 uppercase bg-red-200 rounded-md border border-transparent hover:text-red-700 hover:bg-red-300 disabled:opacity-50 disabled:cursor-not-allowed">
Delete Selected
<x-primary-button wire:click="export('csv')">CSV</x-primary-button>
<x-primary-button wire:click="export('xlsx')">XLSX</x-primary-button>
<x-primary-button wire:click="export('pdf')">PDF</x-primary-button>

products export buttons

Next, we need to install the Laravel Excel package and create Export...

This lesson is only for Premium Members.
Want to access all lessons of this course?

You also get:

  • 59 courses (1057 lessons, 42 h 44 min total)
  • Premium tutorials
  • Access to repositories
  • Private Discord