Skip to content

Commit e38ddd9

Browse files
committed
Updates filename when sequence is updated. resolves #105
1 parent b37959e commit e38ddd9

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

src/Invoice.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
use LaravelDaily\Invoices\Traits\SerialNumberFormatter;
1919

2020
/**
21-
* Class Invoices
22-
* @package LaravelDaily\Invoices
21+
* Class Invoices.
2322
*/
2423
class Invoice
2524
{
@@ -29,7 +28,7 @@ class Invoice
2928
use SavesFiles;
3029
use SerialNumberFormatter;
3130

32-
const TABLE_COLUMNS = 4;
31+
public const TABLE_COLUMNS = 4;
3332

3433
/**
3534
* @var string
@@ -143,7 +142,9 @@ class Invoice
143142

144143
/**
145144
* Invoice constructor.
145+
*
146146
* @param string $name
147+
*
147148
* @throws \Illuminate\Contracts\Container\BindingResolutionException
148149
*/
149150
public function __construct($name = 'Invoice')
@@ -184,16 +185,17 @@ public function __construct($name = 'Invoice')
184185

185186
/**
186187
* @param string $name
187-
* @return Invoice
188+
*
188189
* @throws \Illuminate\Contracts\Container\BindingResolutionException
190+
*
191+
* @return Invoice
189192
*/
190193
public static function make($name = 'Invoice')
191194
{
192195
return new static($name);
193196
}
194197

195198
/**
196-
* @param array $attributes
197199
* @return Party
198200
*/
199201
public static function makeParty(array $attributes = [])
@@ -202,7 +204,6 @@ public static function makeParty(array $attributes = [])
202204
}
203205

204206
/**
205-
* @param string $title
206207
* @return InvoiceItem
207208
*/
208209
public static function makeItem(string $title = '')
@@ -211,7 +212,6 @@ public static function makeItem(string $title = '')
211212
}
212213

213214
/**
214-
* @param InvoiceItem $item
215215
* @return $this
216216
*/
217217
public function addItem(InvoiceItem $item)
@@ -223,6 +223,7 @@ public function addItem(InvoiceItem $item)
223223

224224
/**
225225
* @param $items
226+
*
226227
* @return $this
227228
*/
228229
public function addItems($items)
@@ -235,8 +236,9 @@ public function addItems($items)
235236
}
236237

237238
/**
238-
* @return $this
239239
* @throws Exception
240+
*
241+
* @return $this
240242
*/
241243
public function render()
242244
{
@@ -255,8 +257,9 @@ public function render()
255257
}
256258

257259
/**
258-
* @return Response
259260
* @throws Exception
261+
*
262+
* @return Response
260263
*/
261264
public function stream()
262265
{
@@ -269,8 +272,9 @@ public function stream()
269272
}
270273

271274
/**
272-
* @return Response
273275
* @throws Exception
276+
*
277+
* @return Response
274278
*/
275279
public function download()
276280
{

src/Traits/SerialNumberFormatter.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
namespace LaravelDaily\Invoices\Traits;
44

55
/**
6-
* Trait SerialNumberFormatter
7-
* @package LaravelDaily\Invoices\Traits
6+
* Trait SerialNumberFormatter.
87
*/
98
trait SerialNumberFormatter
109
{
@@ -34,7 +33,6 @@ trait SerialNumberFormatter
3433
public $serial_number_format;
3534

3635
/**
37-
* @param string $series
3836
* @return $this
3937
*/
4038
public function series(string $series)
@@ -45,18 +43,17 @@ public function series(string $series)
4543
}
4644

4745
/**
48-
* @param int $sequence
4946
* @return $this
5047
*/
5148
public function sequence(int $sequence)
5249
{
5350
$this->sequence = str_pad((string) $sequence, $this->sequence_padding, 0, STR_PAD_LEFT);
51+
$this->filename($this->getDefaultFilename($this->name));
5452

5553
return $this;
5654
}
5755

5856
/**
59-
* @param string $delimiter
6057
* @return $this
6158
*/
6259
public function delimiter(string $delimiter)
@@ -67,7 +64,6 @@ public function delimiter(string $delimiter)
6764
}
6865

6966
/**
70-
* @param int $value
7167
* @return $this
7268
*/
7369
public function sequencePadding(int $value)
@@ -78,7 +74,6 @@ public function sequencePadding(int $value)
7874
}
7975

8076
/**
81-
* @param string $format
8277
* @return $this
8378
*/
8479
public function serialNumberFormat(string $format)

0 commit comments

Comments
 (0)