/
home
/
sjslayjy
/
public_html
/
scm
/
app
/
Exports
/
Upload File
HOME
namespace App\Exports; use App\Invoice; use Maatwebsite\Excel\Concerns\FromCollection; use Maatwebsite\Excel\Concerns\WithHeadings; class InvoiceExport implements FromCollection, WithHeadings { protected $from; protected $to; public function __construct($from, $to) { $this->from = $from; $this->to = $to; } public function collection() { return Invoice::select( 'unique_no', 'invoice_type', 'delivery_place', 'invoice_number', 'created_at' ) ->whereBetween('created_at', [$this->from, $this->to]) ->get(); } public function headings(): array { return [ 'Unique No', 'Invoice Type', 'Delivery Place', 'Invoice Number', 'Created Date', ]; } }