Skip to content

Commit

Permalink
Delete generated PDFs
Browse files Browse the repository at this point in the history
To avoid having insufficient space on the server, a route for delete
all PDFs generated  is created.

Access to 'project_name' / delete / into your browser to delete
everything.
  • Loading branch information
manutheblacker committed Dec 18, 2020
1 parent bfd03c0 commit 0d17ba6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
11 changes: 11 additions & 0 deletions resources/views/delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

if (is_dir(HS_TMP_FOLDER) ) {
$files = glob(HS_TMP_FOLDER.'*');
foreach($files as $file){
if(is_file($file)) {
unlink($file); // delete file
}
}
echo "<center>Les fichiers temporaires ont été supprimé avec succès.</center>";
}
11 changes: 8 additions & 3 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@
}
);

$router->group(['prefix'=>'api/v1'], function() use($router){
$router->post('/generate-pdf', 'PDFGenerator@generate_pdf');
});
$router->get(
'/delete', function () use ($router) {
return view('delete');
}
);



$router->group(
['prefix'=>'api/v1'], function () use ($router) {
$router->post('/generate-pdf', 'PDFGenerator@generate_pdf');
Expand Down

0 comments on commit 0d17ba6

Please sign in to comment.