1 | <?php |
||||
2 | |||||
3 | namespace HayriCan\IpChecker; |
||||
4 | |||||
5 | /** |
||||
6 | * Laravel IP Checker |
||||
7 | * |
||||
8 | * @author Hayri Can BARÇIN <hayricanbarcin (#) gmail (.) com> |
||||
9 | * @license http://www.opensource.org/licenses/mit-license.php MIT |
||||
10 | * @link https://github.com/HayriCan/laravel-ip-checker |
||||
11 | */ |
||||
12 | |||||
13 | use Exception; |
||||
14 | use HayriCan\IpChecker\Contracts\IpCheckerInterface; |
||||
15 | use HayriCan\IpChecker\Http\Middleware\IpChecker; |
||||
16 | use Illuminate\Support\ServiceProvider; |
||||
0 ignored issues
–
show
|
|||||
17 | use HayriCan\IpChecker\DBDriver; |
||||
18 | use HayriCan\IpChecker\FileDriver; |
||||
19 | |||||
20 | class IpCheckerServiceProvider extends ServiceProvider |
||||
21 | { |
||||
22 | /** |
||||
23 | * Register services. |
||||
24 | * |
||||
25 | * @return void |
||||
26 | * @throws Exception |
||||
27 | */ |
||||
28 | public function register() |
||||
29 | { |
||||
30 | $this->mergeConfigFrom( |
||||
31 | __DIR__ . '/../config/ipchecker.php', 'ipchecker' |
||||
32 | ); |
||||
33 | $this->bindServices(); |
||||
34 | } |
||||
35 | public function boot() |
||||
36 | { |
||||
37 | $this->loadConfig(); |
||||
38 | $this->loadRoutes(); |
||||
39 | $this->loadViews(); |
||||
40 | if (config('ipchecker.driver') === 'db'){ |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
41 | $this->loadMigrations(); |
||||
42 | } |
||||
43 | $this->loadTranslation(); |
||||
44 | } |
||||
45 | |||||
46 | public function bindServices(){ |
||||
47 | $driver = config('ipchecker.driver'); |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
48 | switch ($driver) { |
||||
49 | case 'file': |
||||
50 | $instance = FileDriver::class; |
||||
51 | break; |
||||
52 | case 'db': |
||||
53 | $instance = DBDriver::class; |
||||
54 | break; |
||||
55 | default: |
||||
56 | throw new Exception("Unsupported Driver"); |
||||
57 | break; |
||||
58 | } |
||||
59 | $this->app->singleton(IpCheckerInterface::class,$instance); |
||||
60 | |||||
61 | $this->app->singleton('ipchecker', function ($app) use ($instance){ |
||||
62 | return new IpChecker($app->make($instance)); |
||||
63 | }); |
||||
64 | } |
||||
65 | |||||
66 | public function loadConfig(){ |
||||
67 | $this->publishes([ |
||||
68 | __DIR__ . '/../config/ipchecker.php' => config_path('ipchecker.php') |
||||
0 ignored issues
–
show
The function
config_path was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
69 | ], 'ipchecker'); |
||||
70 | } |
||||
71 | |||||
72 | public function loadRoutes(){ |
||||
73 | $this->loadRoutesFrom(__DIR__ . '/../routes/web.php'); |
||||
74 | } |
||||
75 | |||||
76 | public function loadViews(){ |
||||
77 | $this->loadViewsFrom(__DIR__ . '/../resources/views', 'ipchecker'); |
||||
78 | } |
||||
79 | |||||
80 | public function loadMigrations(){ |
||||
81 | $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
||||
82 | } |
||||
83 | |||||
84 | public function loadTranslation(){ |
||||
85 | $this->loadTranslationsFrom(__DIR__ . '/lang', 'ipchecker'); |
||||
86 | |||||
87 | $this->publishes([ |
||||
88 | __DIR__ . '/lang' => resource_path('lang/vendor/ipchecker'), |
||||
0 ignored issues
–
show
The function
resource_path was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
89 | ], 'ipchecker'); |
||||
90 | } |
||||
91 | |||||
92 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths