class Waybill (View source)

Main entry point for creating new waybills

Methods

void
write(array|null $args = null)

Run WriteHTML function

mpdf(Mpdf $mpdf)

Setter for $mpdf

state(array $state)

Setter for $state

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

string
__toString()

Magic method to convert the waybills type to string

static Waybill
of(ParcelService $parcelService, Mpdf|null $mpdf = null)

Factory method to create an instance of Waybill

static Waybill
make(ParcelService $parcelService)

Factory method to create an instance without mpdf instance of Waybill

Details

void write(array|null $args = null)

Run WriteHTML function

Parameters

array|null $args

The array of arguments for a model or table fields

Return Value

void

Waybill mpdf(Mpdf $mpdf)

Setter for $mpdf

Parameters

Mpdf $mpdf

The mpdf of the waybills

Return Value

Waybill

The method returns self instance

Examples

$waybill = Waybill::of(ParcelService::Cj)->mpdf(SupportMpdf::instance())->...

Waybill state(array $state)

Setter for $state

Parameters

array $state

The state of the waybills

Return Value

Waybill

The method returns self instance

Examples

$waybill = Waybill::of(ParcelService::Cj)->state(['total_printed_count' => '581'])->...

Waybill path(string $path)

Setter for $path

Parameters

string $path

The path to save the waybills

Return Value

Waybill

The method returns self instance

Examples

$waybill = Waybill::of(ParcelService::Cj)->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

$waybill = Waybill::of(ParcelService::Cj)->toArray();

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

Save the waybills data to PDF

Parameters

string $filename

A filename to create

Return Value

mixed

Examples

$waybill = Waybill::of(ParcelService::Cj)->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

$waybill = Waybill::of(ParcelService::Cj)->path(realpath(__DIR__.'/../dist'))->save('test.pdf');

string __toString()

Magic method to convert the waybills type to string

Return Value

string

The method returns the waybills type as string

Examples

echo Waybill::of(ParcelService::Cj)

static Waybill of(ParcelService $parcelService, Mpdf|null $mpdf = null)

Factory method to create an instance of Waybill

Parameters

ParcelService $parcelService

The waybills type

Mpdf|null $mpdf

Return Value

Waybill

The method returns the Waybill instance

Examples

Waybill::of(ParcelService::Cj, $mpdf)->...

static Waybill make(ParcelService $parcelService)

Factory method to create an instance without mpdf instance of Waybill

Parameters

ParcelService $parcelService

The waybills type

Return Value

Waybill

The method returns the Waybill instance

Examples

Waybill::make(ParcelService::Cj)->make($mpdf)->...