Browse Source

Merge pull request 'storage Information' (#54) from Dev-Farhan into staging

Reviewed-on: ibnu/generic-ospro-backend#54
pull/1/head
farhantock 10 months ago
parent
commit
3a02ac196d
  1. 16
      app/Http/Controllers/Controller.php
  2. 2
      routes/web.php

16
app/Http/Controllers/Controller.php

@ -13,6 +13,8 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Laravel\Lumen\Routing\Controller as BaseController;
use RecursiveIteratorIterator;
use RecursiveDirectoryIterator;
class Controller extends BaseController
{
@ -54,7 +56,19 @@ class Controller extends BaseController
];
}
protected function setLimitsStorage($company, $dokumen, $name, $initPath, $destinatePath) {
public function storage($company_name)
{
$directory = 'assets/' . urldecode($company_name);
$size = 0;
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file) {
$size += $file->getSize();
}
return round($size / 1048576, 2);
}
protected function setLimitsStorage($company, $dokumen, $name, $initPath, $destinatePath)
{
$totalSize = 0;
$sizeFile = $dokumen->getSize();
// Path

2
routes/web.php

@ -587,5 +587,7 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->post('/demo-management/search', 'DemoController@search');
$router->delete('/demo-management/delete/{id}', 'DemoController@delete');
$router->get('/demo-management/list', 'DemoController@list');
$router->get('information-storage/{company_name}', 'Controller@storage');
});
});

Loading…
Cancel
Save