Approven von Beitragserstattungen
This commit is contained in:
@@ -16,13 +16,21 @@ class UploadFileProvider {
|
||||
$this->costUnit = $costUnit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Das Ablageverzeichnis der Belege einer Kostenstelle, relativ zur Disk `local`
|
||||
* (Wurzel `storage/app/private`).
|
||||
*
|
||||
* Öffentlich, weil Belege nicht nur aus einem Upload entstehen: Eine Beitragserstattung erzeugt ihren
|
||||
* Eigenbeleg im Speicher und legt ihn über den FileWriteProvider ab -- landen soll er trotzdem dort,
|
||||
* wo alle anderen Belege liegen.
|
||||
*/
|
||||
public static function directoryFor(CostUnit $costUnit) : string {
|
||||
return sprintf('%1$s/invoices/%2$s', app('tenant')->slug, $costUnit->id);
|
||||
}
|
||||
|
||||
public function saveUploadedFile() : ?InvoiceFile {
|
||||
try {
|
||||
$directory = sprintf(
|
||||
'%1$s/invoices/%2$s',
|
||||
app('tenant')->slug,
|
||||
$this->costUnit->id
|
||||
);
|
||||
$directory = self::directoryFor($this->costUnit);
|
||||
|
||||
$filename = $this->normalizeFilename($this->file->getClientOriginalName());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user