diff --git a/app/Http/Controllers/Operator/SiswaController.php b/app/Http/Controllers/Operator/SiswaController.php index 9cbba7e..623eb47 100644 --- a/app/Http/Controllers/Operator/SiswaController.php +++ b/app/Http/Controllers/Operator/SiswaController.php @@ -10,7 +10,9 @@ use App\Imports\SiswaImport; use App\Models\Kehadiran; use App\Models\Ruangan; -use Illuminate\Support\Arr; +use Illuminate\Support\Str; +use Illuminate\Support\Facades\Request; +use Illuminate\Support\Facades\Storage; use Maatwebsite\Excel\Facades\Excel; class SiswaController extends Controller @@ -60,6 +62,21 @@ public function import(StoreImportSiswaRequest $storeImportSiswaRequest) { return redirect()->back()->with('success', 'data berhasil disimpan'); } + /** + * Download and convert template + */ + public function convert(Request $request, $filetype) { + $filetype = Str::lower($filetype); + if (!Storage::exists('excel/MS.T-Master.xlsx')) { + return redirect()->back()->with('error', 'maaf file tidak ditemukan. silahkan lapor jika ini merupakan bug'); + } + $storage = Storage::path('excel/MS.T-Master.xlsx'); + + if ($filetype == "xlsx") { + return response()->download($storage, Str::lower(config('app.name')) . '-template.xlsx'); + } + } + /** * Display the specified resource. */ diff --git a/resources/views/errors/503.blade.php b/resources/views/errors/503.blade.php new file mode 100644 index 0000000..42e574d --- /dev/null +++ b/resources/views/errors/503.blade.php @@ -0,0 +1,37 @@ + + + +
+ + + +Saat ini layanan tidak tersedia, tunggu beberapa saat
+