Conditions | 4 |
Paths | 2 |
Total Lines | 22 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function boot() |
||
17 | { |
||
18 | $this->publishes([ |
||
19 | __DIR__.'/config/visits.php' => config_path('visits.php'), |
||
20 | ], 'config'); |
||
21 | |||
22 | if (! class_exists('CreateVisitsTable')) { |
||
23 | $this->publishes([ |
||
24 | __DIR__.'/../database/migrations/create_visits_table.php.stub' => database_path('migrations/'.date('Y_m_d_His', time()).'_create_visits_table.php'), |
||
25 | ], 'migrations'); |
||
26 | } |
||
27 | |||
28 | Carbon::macro('endOfxHours', function ($xhours) { |
||
29 | if ($xhours > 12) { |
||
30 | throw new \Exception('12 is the maximum period in xHours feature'); |
||
31 | } |
||
32 | $h = $this->hour; |
||
|
|||
33 | |||
34 | return $this->setTime( |
||
35 | ($h % $xhours == 0 ? 'min' : 'max')($h - ($h % $xhours), $h - ($h % $xhours) + $xhours), |
||
36 | 59, |
||
37 | 59 |
||
38 | ); |
||
61 |