Skip to content

Commit a38217b

Browse files
committed
Update filename generation and validation rules in download actions
1 parent c649f43 commit a38217b

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

app/Helpers/Cetak.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static function cetak($jenis, $models, $filename, $template_id, $tanggal
5858
}
5959

6060
$mainTemplate->settempDocumentMainPart($mainXml);
61-
$filename .= '.docx';
61+
$filename .= '_'.uniqid().'.docx';
6262
$mainTemplate->saveAs(Storage::path('public/'.$filename));
6363

6464
return $filename;

app/Nova/Actions/Download.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function withTanggal()
4545
public function withOptionPengelola($role)
4646
{
4747
$this->withOptionPengelola = true;
48+
$this->withTanggal = true;
4849
$this->role = $role;
4950

5051
return $this;
@@ -84,7 +85,7 @@ public function fields(NovaRequest $request)
8485
{
8586
$fields = [
8687
Text::make('Nama File', 'filename')
87-
->rules('required', 'alpha_dash:ascii')
88+
->rules('required', 'regex:/^[a-zA-Z0-9_\-\s]+$/')
8889
->help('tanpa extensi file')
8990
->default(fn () => uniqid()),
9091
Select::make('Template')

app/Nova/Lenses/PemeliharaanBarang.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ public function actions(NovaRequest $request)
197197
Download::make('karken_pemeliharaan', 'Unduh Kartu Kendali Pemeliharaan')
198198
->showInline()
199199
->showOnDetail()
200-
->withTanggal()
201200
->withOptionPengelola('bmn')
202201
->confirmButtonText('Unduh');
203202
}

app/Nova/Lenses/RekapBarangPersediaan.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ public function actions(NovaRequest $request)
139139
Download::make('karken_persediaan', 'Unduh Kartu Kendali Persediaan')
140140
->showInline()
141141
->showOnDetail()
142-
->withTanggal()
143142
->withOptionPengelola('bmn')
144143
->confirmButtonText('Unduh');
145144
}

0 commit comments

Comments
 (0)