class WaybillCollection (View source)

Main entry point for creating new waybills

Methods

add(Waybill|array $waybill)

Adds a Waybill object to the container

path(string $path)

Setter for $path

array
toArray()

Export the waybills data to array or CSV

mixed
save(string $filename = 'waybills.pdf')

Save the waybills data to PDF

mixed
download(string $filename = 'waybills.pdf')

Download the waybills data to PDF

of(Waybills|null $waybills = null, int $count = 1, Mpdf|null $mpdf = null)

Factory method to create an instance of WaybillCollection

make(Waybills|null $waybills = null, int $count = 1)

Factory method to create an instance without mpdf of WaybillCollection

Details

WaybillCollection add(Waybill|array $waybill)

Adds a Waybill object to the container

Parameters

Waybill|array $waybill

a Waybill object

Return Value

WaybillCollection

The method returns the instance

WaybillCollection path(string $path)

Setter for $path

Parameters

string $path

The path to save the waybills

Return Value

WaybillCollection

The method returns self instance

Examples

$waybillCollection = WaybillCollection::of($waybill, 5)->path(realpath(__DIR__.'/../dist'))->...

array toArray()

Export the waybills data to array or CSV

Return Value

array

The method returns the waybills data as array or CSV string

Examples

$waybillCollection = WaybillCollection::of($waybill, 5)->toArray();

mixed save(string $filename = 'waybills.pdf')

Save the waybills data to PDF

Parameters

string $filename

A filename to create

Return Value

mixed

Examples

$waybillCollection = WaybillCollection::of($waybill, 5)->path(realpath(__DIR__.'/../dist'))->save('test.pdf');

mixed download(string $filename = 'waybills.pdf')

Download the waybills data to PDF

Parameters

string $filename

A filename to create

Return Value

mixed

Examples

$waybillCollection = WaybillCollection::of($waybill, 5)->path(realpath(__DIR__.'/../dist'))->download('test.pdf');

static WaybillCollection of(Waybills|null $waybills = null, int $count = 1, Mpdf|null $mpdf = null)

Factory method to create an instance of WaybillCollection

Parameters

Waybills|null $waybills
int $count
Mpdf|null $mpdf

Return Value

WaybillCollection

The method returns the WaybillCollection instance

Examples

WaybillCollection::of($waybill, 5, $mpdf)->...

static WaybillCollection make(Waybills|null $waybills = null, int $count = 1)

Factory method to create an instance without mpdf of WaybillCollection

Parameters

Waybills|null $waybills
int $count

Return Value

WaybillCollection

The method returns the WaybillCollection instance

Examples

WaybillCollection::make($waybill, 5)->mpdf($mpdf)->...