1 | <?php |
||
10 | class StatsController extends Controller { |
||
11 | |||
12 | const DEFAULT_INTERVAL = '15d'; |
||
13 | |||
14 | protected $saleRepository; |
||
15 | protected $productRepository; |
||
16 | |||
17 | public function __construct(SaleRepository $saleRepository, ProductRepository $productRepository) |
||
22 | |||
23 | public function dashboard($interval=self::DEFAULT_INTERVAL) |
||
38 | |||
39 | /** |
||
40 | * Extracts a Carbon interval from the short notation (30d, 4h, ...) used in the URL |
||
41 | * |
||
42 | * @param $intervalString |
||
43 | * @return CarbonInterval |
||
44 | * @throws Exception |
||
45 | */ |
||
46 | private function extractIntervalData($intervalString) |
||
72 | |||
73 | /** |
||
74 | * Transforms a Carbon interval in a readable string (last 8 hours, ...) |
||
75 | * |
||
76 | * @param CarbonInterval $interval |
||
77 | * @return string |
||
78 | */ |
||
79 | private function getTitleFromInterval(CarbonInterval $interval) |
||
89 | |||
90 | } |
||
91 |