Browse Source

storage Information

pull/1/head
farhantock 9 months ago
parent
commit
e735c33734
  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 Illuminate\Support\Facades\Http;
use Laravel\Lumen\Routing\Controller as BaseController; use Laravel\Lumen\Routing\Controller as BaseController;
use RecursiveIteratorIterator;
use RecursiveDirectoryIterator;
class Controller extends BaseController 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; $totalSize = 0;
$sizeFile = $dokumen->getSize(); $sizeFile = $dokumen->getSize();
// Path // 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->post('/demo-management/search', 'DemoController@search');
$router->delete('/demo-management/delete/{id}', 'DemoController@delete'); $router->delete('/demo-management/delete/{id}', 'DemoController@delete');
$router->get('/demo-management/list', 'DemoController@list'); $router->get('/demo-management/list', 'DemoController@list');
$router->get('information-storage/{company_name}', 'Controller@storage');
}); });
}); });

Loading…
Cancel
Save