1 | <?php |
||||
2 | |||||
3 | namespace Awssat\Visits; |
||||
4 | |||||
5 | use Awssat\Visits\Commands\CleanCommand; |
||||
6 | use Illuminate\Support\Carbon; |
||||
7 | use Illuminate\Support\ServiceProvider; |
||||
8 | |||||
9 | class VisitsServiceProvider extends ServiceProvider |
||||
10 | { |
||||
11 | /** |
||||
12 | * Perform post-registration booting of services. |
||||
13 | * |
||||
14 | * @return void |
||||
15 | */ |
||||
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; |
||||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||||
33 | |||||
34 | return $this->setTime( |
||||
0 ignored issues
–
show
The method
setTime() does not exist on Awssat\Visits\VisitsServiceProvider .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||
35 | ($h % $xhours == 0 ? 'min' : 'max')($h - ($h % $xhours), $h - ($h % $xhours) + $xhours), |
||||
36 | 59, |
||||
37 | 59 |
||||
38 | ); |
||||
39 | }); |
||||
40 | } |
||||
41 | |||||
42 | /** |
||||
43 | * Register any package services. |
||||
44 | * |
||||
45 | * @return void |
||||
46 | */ |
||||
47 | public function register() |
||||
48 | { |
||||
49 | $this->mergeConfigFrom( |
||||
50 | __DIR__.'/config/visits.php', |
||||
51 | 'visits' |
||||
52 | ); |
||||
53 | |||||
54 | $this->app->bind('command.visits:clean', CleanCommand::class); |
||||
55 | |||||
56 | $this->commands([ |
||||
57 | 'command.visits:clean', |
||||
58 | ]); |
||||
59 | } |
||||
60 | } |
||||
61 |