66use Brick \Money \Money ;
77use Carbon \Carbon ;
88use Illuminate \Http \Response ;
9+ use Illuminate \Support \Arr ;
910use Illuminate \Support \Str ;
1011
1112class PdfInvoice
@@ -36,7 +37,7 @@ public function __construct(
3637
3738 public function generateFilename (): string
3839 {
39- return Str::snake ("{ $ this ->name } _ {$ this ->serial_number }.pdf ") ;
40+ return Str::snake ($ this ->name ) . " _ {$ this ->serial_number }.pdf " ;
4041 }
4142
4243 public function getFilename (): string
@@ -49,7 +50,7 @@ public function getLogo(): string
4950 $ type = pathinfo ($ this ->logo , PATHINFO_EXTENSION );
5051 $ data = file_get_contents ($ this ->logo );
5152
52- return 'data:image/ ' . $ type. ';base64, ' . base64_encode ($ data );
53+ return 'data:image/ ' . $ type . ';base64, ' . base64_encode ($ data );
5354 }
5455
5556 public function subTotalAmount (): Money
@@ -58,7 +59,7 @@ public function subTotalAmount(): Money
5859 return Money::ofMinor (0 , config ('invoices.default_currency ' ));
5960 }
6061
61- $ firstItem = $ this ->items [ 0 ] ;
62+ $ firstItem = Arr:: first ( $ this ->items ) ;
6263
6364 $ currency = $ firstItem ->currency ;
6465
@@ -75,7 +76,7 @@ public function totalTaxAmount(): Money
7576 return Money::ofMinor (0 , config ('invoices.default_currency ' ));
7677 }
7778
78- $ firstItem = $ this ->items [ 0 ] ;
79+ $ firstItem = Arr:: first ( $ this ->items ) ;
7980
8081 $ currency = $ firstItem ->currency ;
8182
@@ -92,7 +93,7 @@ public function totalAmount(): Money
9293 return Money::ofMinor (0 , config ('invoices.default_currency ' ));
9394 }
9495
95- $ firstItem = $ this ->items [ 0 ] ;
96+ $ firstItem = Arr:: first ( $ this ->items ) ;
9697
9798 $ currency = $ firstItem ->currency ;
9899
0 commit comments