@@ -36,38 +36,29 @@ Please see the [changelog](CHANGELOG.md) for more information on what has change
3636
3737Via Composer
3838
39- ### Laravel version <= 10
40-
4139``` bash
4240$ composer require laraveldaily/laravel-invoices:^3.0
4341```
4442
45- ### Laravel version <= 8
46-
47- ``` bash
48- $ composer require laraveldaily/laravel-invoices:^2.0
49- ```
50-
51- ### Laravel version <= 7
52-
53- ``` bash
54- $ composer require laraveldaily/laravel-invoices:^1.3
55- ```
43+ > [ Older versions] ( PREVIOUS.md )
5644
5745After installing Laravel Invoices, publish its assets, views, translations and config using the ` invoices:install ` Artisan command:
46+
5847``` bash
5948$ php artisan invoices:install
6049```
6150
6251### Updates
6352
6453Since it is evolving fast you might want to have latest template after update using Artisan command:
54+
6555``` bash
6656$ php artisan invoices:update
6757```
6858> It will give a warning if you really want to override default resources
6959
7060Or alternatively it can be done separately.
61+
7162``` bash
7263$ php artisan vendor:publish --tag=invoices.views --force
7364```
@@ -76,20 +67,6 @@ $ php artisan vendor:publish --tag=invoices.views --force
7667$ php artisan vendor:publish --tag=invoices.translations --force
7768```
7869
79- ### For Laravel version < 5.5
80-
81- If you don't use auto-discovery, add the ServiceProvider to the providers array in ` config/app.php `
82-
83- ``` php
84- LaravelDaily\Invoices\InvoiceServiceProvider::class,
85- ```
86-
87- If you want to use the facade to generate invoices, add this to your facades in ` config/app.php `
88-
89- ``` php
90- 'Invoice' => LaravelDaily\Invoices\Facades\Invoice::class
91- ```
92-
9370## Basic Usage
9471
9572** RandomController.php**
@@ -98,25 +75,25 @@ use LaravelDaily\Invoices\Invoice;
9875use LaravelDaily\Invoices\Classes\Buyer;
9976use LaravelDaily\Invoices\Classes\InvoiceItem;
10077
101- < ...>
78+ // ...
10279
103- $customer = new Buyer([
104- 'name' => 'John Doe',
105- 'custom_fields' => [
106- 107- ],
108- ]);
80+ $customer = new Buyer([
81+ 'name' => 'John Doe',
82+ 'custom_fields' => [
83+ 84+ ],
85+ ]);
10986
110- $item = (new InvoiceItem())->title ('Service 1')->pricePerUnit(2);
87+ $item = InvoiceItem::make ('Service 1')->pricePerUnit(2);
11188
112- $invoice = Invoice::make()
113- ->buyer($customer)
114- ->discountByPercent(10)
115- ->taxRate(15)
116- ->shipping(1.99)
117- ->addItem($item);
89+ $invoice = Invoice::make()
90+ ->buyer($customer)
91+ ->discountByPercent(10)
92+ ->taxRate(15)
93+ ->shipping(1.99)
94+ ->addItem($item);
11895
119- return $invoice->stream();
96+ return $invoice->stream();
12097```
12198
12299See result [ Invoice_AA_00001.pdf] ( examples/invoice_AA_00001.pdf ) .
@@ -128,89 +105,88 @@ use LaravelDaily\Invoices\Invoice;
128105use LaravelDaily\Invoices\Classes\Party;
129106use LaravelDaily\Invoices\Classes\InvoiceItem;
130107
131- < ...>
108+ // ...
132109
133- $client = new Party([
134- 'name' => 'Roosevelt Lloyd',
135- 'phone' => '(520) 318-9486',
136- 'custom_fields' => [
137- 'note' => 'IDDQD',
138- 'business id' => '365#GG',
139- ],
140- ]);
110+ $client = new Party([
111+ 'name' => 'Roosevelt Lloyd',
112+ 'phone' => '(520) 318-9486',
113+ 'custom_fields' => [
114+ 'note' => 'IDDQD',
115+ 'business id' => '365#GG',
116+ ],
117+ ]);
141118
142- $customer = new Party([
143- 'name' => 'Ashley Medina',
144- 'address' => 'The Green Street 12',
145- 'code' => '#22663214',
146- 'custom_fields' => [
147- 'order number' => '> 654321 <',
148- ],
149- ]);
150-
151- $items = [
152- (new InvoiceItem())
153- ->title('Service 1')
154- ->description('Your product or service description')
155- ->pricePerUnit(47.79)
156- ->quantity(2)
157- ->discount(10),
158- (new InvoiceItem())->title('Service 2')->pricePerUnit(71.96)->quantity(2),
159- (new InvoiceItem())->title('Service 3')->pricePerUnit(4.56),
160- (new InvoiceItem())->title('Service 4')->pricePerUnit(87.51)->quantity(7)->discount(4)->units('kg'),
161- (new InvoiceItem())->title('Service 5')->pricePerUnit(71.09)->quantity(7)->discountByPercent(9),
162- (new InvoiceItem())->title('Service 6')->pricePerUnit(76.32)->quantity(9),
163- (new InvoiceItem())->title('Service 7')->pricePerUnit(58.18)->quantity(3)->discount(3),
164- (new InvoiceItem())->title('Service 8')->pricePerUnit(42.99)->quantity(4)->discountByPercent(3),
165- (new InvoiceItem())->title('Service 9')->pricePerUnit(33.24)->quantity(6)->units('m2'),
166- (new InvoiceItem())->title('Service 11')->pricePerUnit(97.45)->quantity(2),
167- (new InvoiceItem())->title('Service 12')->pricePerUnit(92.82),
168- (new InvoiceItem())->title('Service 13')->pricePerUnit(12.98),
169- (new InvoiceItem())->title('Service 14')->pricePerUnit(160)->units('hours'),
170- (new InvoiceItem())->title('Service 15')->pricePerUnit(62.21)->discountByPercent(5),
171- (new InvoiceItem())->title('Service 16')->pricePerUnit(2.80),
172- (new InvoiceItem())->title('Service 17')->pricePerUnit(56.21),
173- (new InvoiceItem())->title('Service 18')->pricePerUnit(66.81)->discountByPercent(8),
174- (new InvoiceItem())->title('Service 19')->pricePerUnit(76.37),
175- (new InvoiceItem())->title('Service 20')->pricePerUnit(55.80),
176- ];
177-
178- $notes = [
179- 'your multiline',
180- 'additional notes',
181- 'in regards of delivery or something else',
182- ];
183- $notes = implode("<br >", $notes);
184-
185- $invoice = Invoice::make('receipt')
186- ->series('BIG')
187- // ability to include translated invoice status
188- // in case it was paid
189- ->status(__('invoices::invoice.paid'))
190- ->sequence(667)
191- ->serialNumberFormat('{SEQUENCE}/{SERIES}')
192- ->seller($client)
193- ->buyer($customer)
194- ->date(now()->subWeeks(3))
195- ->dateFormat('m/d/Y')
196- ->payUntilDays(14)
197- ->currencySymbol('$')
198- ->currencyCode('USD')
199- ->currencyFormat('{SYMBOL}{VALUE}')
200- ->currencyThousandsSeparator('.')
201- ->currencyDecimalPoint(',')
202- ->filename($client->name . ' ' . $customer->name)
203- ->addItems($items)
204- ->notes($notes)
205- ->logo(public_path('vendor/invoices/sample-logo.png'))
206- // You can additionally save generated invoice to configured disk
207- ->save('public');
208-
209- $link = $invoice->url();
210- // Then send email to party with link
211-
212- // And return invoice itself to browser or have a different view
213- return $invoice->stream();
119+ $customer = new Party([
120+ 'name' => 'Ashley Medina',
121+ 'address' => 'The Green Street 12',
122+ 'code' => '#22663214',
123+ 'custom_fields' => [
124+ 'order number' => '> 654321 <',
125+ ],
126+ ]);
127+
128+ $items = [
129+ InvoiceItem::make('Service 1')
130+ ->description('Your product or service description')
131+ ->pricePerUnit(47.79)
132+ ->quantity(2)
133+ ->discount(10),
134+ InvoiceItem::make('Service 2')->pricePerUnit(71.96)->quantity(2),
135+ InvoiceItem::make('Service 3')->pricePerUnit(4.56),
136+ InvoiceItem::make('Service 4')->pricePerUnit(87.51)->quantity(7)->discount(4)->units('kg'),
137+ InvoiceItem::make('Service 5')->pricePerUnit(71.09)->quantity(7)->discountByPercent(9),
138+ InvoiceItem::make('Service 6')->pricePerUnit(76.32)->quantity(9),
139+ InvoiceItem::make('Service 7')->pricePerUnit(58.18)->quantity(3)->discount(3),
140+ InvoiceItem::make('Service 8')->pricePerUnit(42.99)->quantity(4)->discountByPercent(3),
141+ InvoiceItem::make('Service 9')->pricePerUnit(33.24)->quantity(6)->units('m2'),
142+ InvoiceItem::make('Service 11')->pricePerUnit(97.45)->quantity(2),
143+ InvoiceItem::make('Service 12')->pricePerUnit(92.82),
144+ InvoiceItem::make('Service 13')->pricePerUnit(12.98),
145+ InvoiceItem::make('Service 14')->pricePerUnit(160)->units('hours'),
146+ InvoiceItem::make('Service 15')->pricePerUnit(62.21)->discountByPercent(5),
147+ InvoiceItem::make('Service 16')->pricePerUnit(2.80),
148+ InvoiceItem::make('Service 17')->pricePerUnit(56.21),
149+ InvoiceItem::make('Service 18')->pricePerUnit(66.81)->discountByPercent(8),
150+ InvoiceItem::make('Service 19')->pricePerUnit(76.37),
151+ InvoiceItem::make('Service 20')->pricePerUnit(55.80),
152+ ];
153+
154+ $notes = [
155+ 'your multiline',
156+ 'additional notes',
157+ 'in regards of delivery or something else',
158+ ];
159+ $notes = implode("<br >", $notes);
160+
161+ $invoice = Invoice::make('receipt')
162+ ->series('BIG')
163+ // ability to include translated invoice status
164+ // in case it was paid
165+ ->status(__('invoices::invoice.paid'))
166+ ->sequence(667)
167+ ->serialNumberFormat('{SEQUENCE}/{SERIES}')
168+ ->seller($client)
169+ ->buyer($customer)
170+ ->date(now()->subWeeks(3))
171+ ->dateFormat('m/d/Y')
172+ ->payUntilDays(14)
173+ ->currencySymbol('$')
174+ ->currencyCode('USD')
175+ ->currencyFormat('{SYMBOL}{VALUE}')
176+ ->currencyThousandsSeparator('.')
177+ ->currencyDecimalPoint(',')
178+ ->filename($client->name . ' ' . $customer->name)
179+ ->addItems($items)
180+ ->notes($notes)
181+ ->logo(public_path('vendor/invoices/sample-logo.png'))
182+ // You can additionally save generated invoice to configured disk
183+ ->save('public');
184+
185+ $link = $invoice->url();
186+ // Then send email to party with link
187+
188+ // And return invoice itself to browser or have a different view
189+ return $invoice->stream();
214190```
215191
216192See result [ Roosevelt Lloyd Ashley Medina.pdf] ( examples/Roosevelt%20Lloyd%20Ashley%20Medina.pdf ) .
@@ -406,6 +382,7 @@ Almost every configuration value can be overrided dynamically by methods.
406382- toHtml() - render html view instead of pdf
407383
408384## InvoiceItem
385+ - make(string) - [ static function] same as ` (new InvoiceItem())->title(string) `
409386- title(string) - product or service name
410387- description(string) - additional information for service entry
411388- units(string) - measurement units of item (adds units columns if set)
0 commit comments